How to make a .NET application for different languages

The application I'm writing is almost complete, and I would like people who speak different languages ​​to use it.

I'm not sure where to start, what is the difference between globalization and culture regarding programming?

How to accept unusual phrases such as "this application was created for this and this" instead of "File", "Open", "Save, etc." ) and include them in the words "Spanish"?

Thank you very much: -)

+4
source share
5 answers

Microsoft already has a very good tutorial

+5
source

You have different things to make a "globalized" application.

1) Translate each label in your forms and controls in the application

You need to set the "Localizable" property to true for each form and control. This property allows you to create resource files in each language and region. Now, using the Language property, you can choose which language you want to support. When you select a language from the list with the list, your form (or control) will be automatically switched to that language. Now your job is to translate each word into a control. Once you make the modification, Visual Studio will create a resource file for a specific language. (For example, MyForm.fr-FR.resx for French-French).

2) Import each line of hard code into your code into a resx file

Create a resource file (personally, I use StringTable.resx) and add each line to translate to this file. After that, create a resource file for each language that you want to support, and translate the lines in each file. For example, if you want to support French, you create StringTable.fr.resx or StringTable.fr-FR.resx for French-French. With the ResourceManager class, you can load every row.

Note. If you are using Visual Studio 2005 or 2008, you already have the default resource files.

3) You need to carefully develop your forms and control

Microsoft Recommendations: User Guides

4) Work with date and numbers

If your application creates data files that can be sent to another user in another region, you need to think about it when you save your data in a file. Therefore, always indicate your time in UTC and perform the conversion in local mode only when downloading information. The same applies to decimal numbers, especially if they are stored in the text.


When you compile your application, Visual Studion will create a file with sound, such as MyApplication.fr.dll , in the subfolder fr . To load this DLL, you need to switch the language of the current thread at application startup.

Here is the code:

CultureInfo ci = new CultureInfo("fr"); Thread.CurrentThread.CurrentUICulture = ci; 
+5
source

All your questions will be answered in the next book. The first chapters explain all the basic concepts and terminology and fantastic abbreviations such as i18n. I did not have time to read it to the end ... but until I read it. Recommended if you are serious about doing it right and having time :)

http://www.amazon.com/NET-Internationalization-Developers-Applications-Development/dp/0321341384 Image http://ecx.images-amazon.com/images/I/51WEMCH8TRL._SL500_AA240_.jpg

+2
source

For a very simple system, create an interface that defines methods such as GetSaveText (), etc., and allow these applications to be connected to your application.

0
source

This should be a pretty good solution for any point from 10-1000 lines:

Have a resource file for each locale. I don't know .NET, but I'm sure there is a general way to do this. Then, in your code to retrieve the resources, load the appropriate browser locale based on your user. Ask this code to print the correct string for some key.

An example of the contents of a file if I implemented it from scratch:

resources.en:

 save=Save close=Close ok=OK areYouSure=Are you sure? 

resources.es:

 save=I don't know how to say anything in Spanish, oops close=... ok=... areYouSure=... 
0
source

Source: https://habr.com/ru/post/1276846/


All Articles