mardi 24 mars 2015

Localization in iOS- Xamarin

I am using the following code for localization



public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);

this.lblLocale.Text =
string.Format("Locale: {0} - Language: {1}", NSLocale.CurrentLocale.LocaleIdentifier, NSLocale.PreferredLanguages[0]);

string resourcePath = NSBundle.MainBundle.PathForResource(NSLocale.PreferredLanguages[0], "lproj");
NSBundle localeBundle = NSBundle.FromPath(resourcePath);
this.lblLocalizedOutput.Text = localeBundle.LocalizedString("Have a nice day!", "Localized output on MultipleLanguageAppViewController");

}


But the issue what I am facing is, I am getting the language as "en" always.


while executing this code NSLocale.PreferredLanguages[0]


why it is always returning en. Please help




Aucun commentaire:

Enregistrer un commentaire