Globalization in CF 2.0

L

Lonifasiko

Hi,

I've heard VS.NET 2005 comes with good optimizations related to
resource management and localization/globalization issues.Where are
they? Which is the best way to achieve a CF 2.0 globalized application?

The way I was working was include a ResourceManager object in each
class/form and retrieve strings from the .resx file attached to the
class. Should I continue doing it this way or there has been such an
improvement that I should rapidly change to a newer way?

I've seen that there is a also a .resx file in the project's
properties. Can this .resx file be used as the unique resx file for
whole the application, from which I retrieve English texts? And then
can I add another .resx file for Spanish texts here?

Thanks very much.
 
J

jlivermore

Take a look at the System.Threading class. An application localizes
according to the CultureInfo setting of the current thread
(System.Threading.Thread.CurrentThread.CultureInfo I believe). By
changing this setting, you can switch language contexts during runtime.
The Resources.resx file is the standard resource file used by an
application to pull localized resources. You may access resources from
there with Properties.Resources.[RESOURCENAME]. Additional .resx files
can be created for different languages. Just make the suffix of the
file the same as the language for which you are localizing. For
example...Resources.fr-CA.resx (Candian French).

Hope that helps.

Thanks,
John
 
L

Lonifasiko

A strange thing has happened in my project inside VS.NET 2005 Beta2.

Under "Properties" of my project, I had one general resources file
called Resources.resx.
I thougth would be a good idea to have one .resx file per culture
available in my application, so I added another .resx file.
I have now two .resx files under "Properties", but I cannot access
them. With only one file, I was able to access strings
this way:

Properties.Resources.ResourceManager.GetString("kk",
Properties.Resources.Culture);

No I can't. Does VS.NET 2005 not permit adding resources files here,
under "Properties"?

I need a good way of accessing multiple resource files.

Thanks very much in advance.
 
L

Lonifasiko

I've surprisingly noticed that it's necessary to have one resource file
called "Resources.resx" as the default resource file, and then, the
other resource files (Resources.en-US.resx, Resources.en-GB.resx and so
on).

If I rename the default resource file to Resources.es-ES.resx, then I
cannot access any resource file. Even more, the application does not
compile. Incredible but true.

Summarizing, in order to access resource files this way
(Properties.Resources.ResourceName), the default resource file must be
called Resources.resx. Then you can add another culture dependant
resource files, but the first one must exist and must be called the way
I've told you.

Hope that helps. Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top