Can I use resx files for different languages ​​in a Windows Forms application?

Can resx files for different languages ​​be used in a Windows Forms application the same as in a web project?

I think you can set the culture of the stream and it should read from the correct file.

The problem I am having is how to create files for each language in visual studio 2008, feel like there is something very simple that I am missing.

thank

Shiraz

+2


source to share


2 answers


You need to include a resource file for each culture you want to support. They are added to the project in the same location as the main resource file and must follow a strict naming convention.

The resource file name must include the country code and language, for example:

  • Resources.fr-FR.resx for French (in France)
  • Resources.fr-CA.resx for French (in Canada)
  • Resources.es-ES.resx for Spanish (in Spain)
  • Resources.es-MX.resx for Spanish (in Mexico)

However, if you know that you do not need to support regional variations in a language, you can simply name the file with the name of that language:



  • Resources.fr.resx for French
  • Resources.en.resx for English
  • Resources.es.resx for Spanish

This will depend on how important it is that you localize to each country and / or how upset your users are if they see "wrong" text (eg color / color, etc. for English / English) p>

See here for a list of culture codes.

NOTE. I haven't had a chance to test the code, but it looks complete.

+5


source


Just add a resource file and change its name to have a short language name. For example, if the default is Resource.resx, for a Hebrew resource the resource will be called Resources.he.resx, and for a German it will be called Resources.de.resx.



+1


source







All Articles