Hello friends, in this article, I will talk about how we can manage permissions for different languages on the iOS side with Xamarin Forms. Many applications offer multi-language support, but we have to show the user that everything is a whole so that the integrity of the application is not compromised. For example, although your application supports English and Turkish languages, if the permissions are only in Turkish, it will be a problem for foreign users. At the same time, while the app is being reviewed on the App Store, reviewers ask you to fix your app when they see it.
First, we come to the iOS layer of our project, and then under the Resource folder, we create a folder called Base.lproj to add the strings to be used in different languages. In addition to this, you should add folders such as tr.lproj, which will be used in other languages in your application.
Then we need to fill in these folders. For this, we need to hover over the folders we created and add a new file from here. We must choose EmptyTextFile from the options that appear and save it as InfoPlist.strings.
As the last step, we need to fill in the files we have created. The work we need to do for this is as follows. You know, every property in Info.Plist is of key value type. For this reason, the variables we will create here will be like this.
"NSCameraUsageDescription" = "Camera string"; "NSLocationWhenInUseUsageDescription" = "Location string"; "NSLocationAlwaysAndWhenInUseUsageDescription" = "Location string"; "NSLocationAlwaysUsageDescription" = "Location string"; "NSCalendarsUsageDescription" = "Calendar string";
Whichever permission you need, you should get this key from Info.Plist and write it here and then enter the string. Of course, in the Info.Plist, you should leave blank for these permissions so that the application can pull these permission texts from here.
As a last step, you should add the languages you use to the Localizations array in Info.Plist.
If you have questions, you can reach us by sending an e-mail or comment. Good work.
Leave a Reply