mulyiple language in c#.net application

S

saravanan.arul

Hi this sarav...

I having some languages in dropdownlist(like
english,tamil,japan.......)

based on this dropdown selection full application need to change
corresponding language..


Anyone give solution for this
 
P

PenguinPig

Hi Sarav...

I am not sure you are develop standalone app or web app
For my experience, I am develop multilanguage webapp as follow

1. Create a text file, and store your text in name-pair format, e.g.
lblFirstName=First Name
lblLastName=Last Name
If you are stored english, please save the file in Resource.txt, if you are
save Traditional Chinese, please save the file in Resource.zh-hk.txt
It is not compulsory, just for easy maintenance

2. Download .Net SDK, and locate the tool
regen.exe
al.exe
and execute following, e.g. English
resgen Resources.txt Resources.resources
al /t:lib /embed:Resources.resources /culture:en
/out:%APP_ROOT%\Resources.dll

e.g. Traditional Chinese
resgen Resources.zh-hk.txt Resources.zh-hk.resources
al /t:lib /embed:Resources.zh-hk.resources /culture:zh-hk
/out:%APP_ROOT%\zh-hk\Resources.resources.dll

Please remember that using sultable culture to compile the resource file,
and the compiled dll file must placed under the bin of your application
root.
If it is English resource, just placed under the application root/bin, if it
is other than English, then you need create the folder, with the culture
name, under the application root/bin, and place the dll inside.

3. In your application, for example, cs file, add some code to get the text
from the resource file
// get the language package
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language); //
language should be "en", "zh-hk" or other microsoft acceptable culture code

Assembly assembly = Assembly.Load("Resources");
resources = new ResourceManager("Resources", assembly);

// if you like to get the text of lblFirstName, then
string text = resources.GetString("lblFirstName");

Hope this can help you
 

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