Heisenbelge
Heisenbelge

Reputation: 185

How to localize Info.plist content in Visual Studio

I have a Xamarin iOS application that supports 4 different languages ​​at the moment. However I would now like to be able to translate the contents of my info.plist file and its keys like NSCameraUsageDescription so that its values ​​can be translated as well.

I have done quite a lot of research so far and by searching through the documentation it is advisable to create an InfoPlist.strings file which would contain my key NSCameraUsageDescription = "the content here".

There would be an InfoPlist.strings file for each language and this would be contained in a folder fr.lproj, es.lproj etc following the language.

I think that it is relatively well explained to exploit this option in Xcode with the possibility to create .strings files and to localize them directly. However, on Visual Studio I have some difficulties to introduce and adapt my files. The equivalent of a .strings file on Xcode is a .resx file on VS ?

How can the relationship between my InfoPlist.strings and my main Info.plist file be in order to tell my application to tap in the folder fr.lproj / InfoPlist.strings when I switch to french for instance.

Am I supposed to create one folder for each language named fr.lproj where I put a single file InfoPlist.strings or InfoPlist.resx with my keys ?

Upvotes: 6

Views: 3302

Answers (1)

nevermore
nevermore

Reputation: 15786

However, on Visual Studio I have some difficulties to introduce and adapt my files. The equivalent of a .strings file on Xcode is a .resx file on VS ?

No, to create a .strings file in visual studio, you should choose add -> new item -> Text File, then change the file name With xxx.strings.

How can the relationship between my InfoPlist.strings and my main Info.plist file be in order to tell my application to tap in the folder fr.lproj / InfoPlist.strings when I switch to french for instance.

If you created the InfoPlist.strings for each language, it will automatically read the configuration in the file of the Corresponding language, and then show the right language. If the key was not find on the InfoPlist.strings, it will use the default value in main Info.plist.

Am I supposed to create one folder for each language named fr.lproj where I put a single file InfoPlist.strings or InfoPlist.resx with my keys ?

Yes, if you have four language to support, you should create 3 xx.lporj folders(another is Base.lporj) and each contains an InfoPlist.strings and Localizable.strings.

In your InfoPlist.strings file, set the key NSCameraUsageDescription = "the content here" and ect....

Read the document may help.

Here is what I just created in my project:

example

Upvotes: 8

Related Questions