Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hi all

I have an application where in the first page user will select the language and rest of the form should display the same language.

i have to send a single exe file for this application.
i did using like setting the language and value for each control by changing the language property, but it's creating separate folders and when i am running only the exe, it's not running, means i need those language folders.
i don't need this.
Please need help from you people to select the best way to do that.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-14 12:30pm    
This is not how it is done. If you put it all in one file, you will break the powerful and easy-to-use mechanism I described in my answer.
If you say "I don't need this" and avoid using this powerful mechanism, you are going to get in trouble which you absolutely don't have to have.
—SA

1 solution

What you want is not how it should be done.

This is done via the use of satellite assemblies. The idea is: you develop all the code in one language which is used for fallback in case no closer localized resources can be found. Usually, English is used, even if the code is developed in not an English-speaking place. You globalize development but putting everything what can be depend on culture, in RESX resource (to be embedded in some executable module of some assembly). Roughly speaking, it is done the "usual" way, as if there was no any localization. Later on, you start localization by adding new satellite assemblies, resource-only ones. You simply copy resources, all source files used by resources, from main assembly to a separate project and do the translation to some culture.

Everything works by setting the output directory of the projects building into satellite assembly in a special "satellite" locations. These should be the sub-directories of the output directory of the main project, named according to full or partial culture names. During runtime, all you do is setting the culture and UI culture of the UI thread (and possibly some other threads) to required culture. It can be done in an application configuration files, but can be switched during runtime — the UI will be automatically switched immediately. This is how:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture%28v=vs.110%29.aspx[^].

It is possible that requested culture is not implemented. Nevertheless, the application will work in some reasonable way. The fallback mechanism will automatically find the closest culture implemented in satellites. If not, it may fallback to the original language of the main product, but in no way will you get empty strings.

Note that you can have a separate team doing just the localization. Everything works out the way which does not requires you to pass them the full source code. You can only provide the installation of existing project and part of project, with resource only, and documentation. This can be enough to complete localization, with minimal supervision by the team developing the main product. For example, you can collaborate with your customers and representatives in a country of different culture, with the language you almost unfamiliar with. Still, you will be able to outsource just the localization to them.

You can find further detail on creation of satellite assemblies in MSDN: http://msdn.microsoft.com/en-us/library/21a15yht%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900