ResourceManager and unsupported platform

I am using ResourceManager to localize the UI of my WinCE 5 software. I have some resource files with text strings in different languages

Resourse.resx
Resourse.de-DE.resx
Resourse.ru-RU.resx

      

When I want to display the user interface in English, I call:

Resourse.Culture = new CultureInfo("en-US");
label1.Text = Resourse.LabelText;

      

in German:

Resourse.Culture = new CultureInfo("de-DE");
label1.Text = Resourse.LabelText;

      

in Russian:

Resourse.Culture = new CultureInfo("ru-RU");
label1.Text = Resourse.LabelText;

      

but here I am getting PlatformNotSupportedException .

I know my WinCE does not contain Russian and I cannot change the OS to add this, so my question is, how can I tell ResourceManger to use Resourse.ru-RU.resx when I installed Culture = new CultureInfo("ru-RU")

?

+3


source to share


3 answers


Below is a HACKED workaround, but it will fix the PlatformNotSupportedException issue. I would also recommend doing this as a last resort. Please note that I only tested this on WinCE 6.0.

If the culture you are trying to implement is not supported by WinCE 6.0, just re-paste it as another culture. For example, instead of labeling Russian culture as "ru-RU" (as above), you can rename it as "eu-ES" (Basque). Provided that the font used supports the Cyrillic character set, the values ​​should be displayed as you wrote them.



Note. You can also rename your resource file to match the target culture you are replacing. If you use "eu-ES" instead of "ru-RU", you must rename your "Resourse.ru-RU.resx" to "Resourse.eu-ES.resx".

What you lose: Any native support provided by the target culture (Russian in this case) (like properly formatted currencies, dates, etc.) as they will now be pulled from the target target culture (Basque This is the case). Note that this should only be a problem in your application if you are formatting your strings through culture (ie StringFormat ({some CultureInfo.GetCurrentCulture}, {additional formatting}, {some numeric value})).

+2


source


The answer Jonathan gave is the exact work I had to do to get my device to show Simplified Chinese. I used "en-ZW" English (Zimbabwe). This worked on three different devices running a different OS (CE5, CE6 and WEH / WM 6.5.3).

If the base Tahoma font doesn't contain everything you need, as in my case, you also need to put the font on the device and make some additional registry changes to enable font linking. It's not very difficult, just a couple of registry entries.

This MSDN link provides information for Chinese fonts, but it will be used the same way for any other set of fonts. http://msdn.microsoft.com/en-us/library/ms901082.aspx



More general MSDN articles on font binding can be found here: http://msdn.microsoft.com/en-us/library/ms901098.aspx

Other than that, the only other parameter I could determine was to collapse the native translation resource.

+2


source


It looks like you're stuck unfortunately. Your problem is unusual because generally the mobile app doesn't need to figure out which culture ID to use. If it just relies on any culture that the system configured for it at startup, users can toggle the global culture setting, which will affect your app and allow your localizations to be used if any.

If you are implementing a language selector inside your application, then I think you need to filter the list of your choices so that you only suggest the cultures supported by the device ( CultureInfo.GetCultures

will give you a list of supported cultures and you can find the subset for which localizations are available).

0


source







All Articles