Forum Xamarin.iOS

Working with Localization, Adding Keys to info.plist Visual Studio Xamarin.ios

EmyKhanEmyKhan USMember

I have started working with localization, my Project is Xamarin.Forms shared project. I need some suggestion what should I use because I have to use localization on all apps iOS, Windows, Android.

I have started working on this http://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/

But I am stuck at first step

Info.plist
Before you begin, configure the Info.plist file with the following keys:

CFBundleDevelopmentRegion - the default language for the application (typically the language spoken by the developers, and used in the storyboards and string and image resources). In the example below, en (for English) is specified.
CFBundleLocalizations - an array of other localizations supported by the application, also using language codes like es (Spanish) and pt-PT (Portuguese spoken in Portugal).

How can I add keys in info.plist I couldn't see any option of adding keys in Visual Studio Xamarin.iOS

Here is screenshot to the Info.plist options http://prntscr.com/831rlm

Apart from that I cannot see any option to even edit info.plist XML because I just thought to add manually.

Best Answer

Answers

  • EmyKhanEmyKhan USMember

    LoriLalonde thanks it worked, Please can you suggest what should I do for localization, I should use RESX Resource file or I should use native for each platform ?

  • LoriLalondeLoriLalonde CAInsider, University, Developer Group Leader ✭✭✭

    @EmyKhan, I prefer to use RESX for strings, and native for any localized images which requires a separate image for each supported language (for example: any images that contain words within the image itself like a Stop sign). However it's totally up to you what works best for your application.

    I place my RESX files in a Portable Class Library along with a helper class to perform the translation. There's a good walkthrough in the Xamarin.Forms documentation section on using the .NET Localization approach with RESX files: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/.

    Note that this approach is not specific to Xamarin.Forms and you can leverage it from your Xamarin.Android and Xamarin.iOS applications even when using native layouts. The only thing to note is that for Android, you won't be able to set any text you want translated within the layout files (in the axml markup), it must be done through C# code. And you still need a single translation in the strings.xml file in each supported langauge for the application label text.

  • EmyKhanEmyKhan USMember

    @LoriLalonde thanks for your suggestion, I tried to understand the sample of RESX but I couldn't. Can you share your sample project you used, I will appreciate your help. Thanks

Sign In or Register to comment.