Xamarin iOS localization using .NET

Viewed 5987

I'm trying to use .NET localization in a portable class library for a Xamarin iOS/Android project. I've followed the steps at:

How to use localization in C#

And have code which looks as follows:

string sText = strings.enter_movie_name;
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr");
sText = strings.enter_movie_name;
lblEnterMovieName.Text = sText;

I've also tried:

ResourceManager resman = new ResourceManager(typeof(MyApplication.strings));
string sText = resman.GetString("enter_movie_name", new CultureInfo("fr"));

I've created strings.resx with enter_movie_name equal to "Enter movie name:" and strings.fr.resx equal to "Entre la movie name:"

However, sText always ends up as "Enter movie name:". I can't seem to get the "Entre la movie name:" version out.

I also saw the post at Cross-platform Localization but couldn't work it out. I also don't want to use the iOS specific version at Localization on Xamarin.iOS as I'd like to be able to get at my strings from a platform independent library.

Can anyone point out where I'm going wrong?

2 Answers
Related