Jonathan
Jonathan

Reputation: 21

How to get localized CFBundleDisplayName with Xamarin

I created an application with Xamarin Studio for iOS. The application name (CFBundleDisplayName) needs to change according to the language of the device. I found a lot of documentation on how to do that with xCode but nothing with Xamarin Studio. Thanks for your help!

Upvotes: 2

Views: 1062

Answers (1)

Lori Lalonde - MSFT
Lori Lalonde - MSFT

Reputation: 368

Add a InfoPlist.strings file within each .lproj directory. Within each language-specific InfoPlist.strings file, add the following line and replace localized value with your translated title:

"CFBundleDisplayName" = "localized value";

This will ensure that the app label will display the translated string on your Home screen.

If you wish to access this value in the code, you can retrieve it like this:

var title = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleDisplayName");
AppTitleLabel.Text = title.ToString();

Upvotes: 1

Related Questions