Hi all,
I am trying to internationalize my interface (running out a G120, netmf 4.3.4.0), and I guess I am missing something.
Here is what I did:
- I created a “resources.resx” with all the menu strings in French (default language)
- I created a “resources.en.resx” with the same string names, and the values in English
- I created a “resources.es.resx” with the same thing, for Spanish.
The a rebuild the whole solution.
I implemented this little piece of code that is supposed to tell me all the available cultures:
cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach (CultureInfo culture in cultures)
Debug.Print("Available culture = " + culture.Name);
As a result, it shows:
… and no Spanish (“es”) …
However, I tried to switch between default (French) and English, and it only work a couple of time out of dozen…
I created a menu updating an enum-typed value, whose value is store into a SDCard storage. When the device boots, the value is read, and the following code is executed:
switch (Configuration.Language)
{
case Languages.English:
ResourceUtility.SetCurrentUICulture(new CultureInfo("en"));
break;
case Languages.French:
ResourceUtility.SetCurrentUICulture(new CultureInfo(""));
break;
case Languages.Spanish:
ResourceUtility.SetCurrentUICulture(new CultureInfo("es"));
break;
default:
ResourceUtility.SetCurrentUICulture(new CultureInfo(""));
break;
}
Debug.Print("Current UI Culture='" + CultureInfo.CurrentUICulture.Name + "'");
Of course, Configuration.Language is correct, and even CurrentUICulture.Name printed out shows the Culture value has been switched properly (between ‘en’ and ‘’ though…)… However, the UI is not translated, in most of case.
The “most of case” is important, because if it would never be translated, I’d assume something was missing in my code. The fact I see my screen translated from time to time tells me I must be close, and I must have a little something missing.
Does anyone have any suggestion of documentation to read, because everything I found is meant for Windows applications, and does not apply to netmf.
FYI, I used the resources’ string as follows:
I am open to any idea...
Thx,
Thomas