Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

localization of an application

Status
Not open for further replies.

sbit72

Programmer
Feb 19, 2007
4
IT
Hello
I'm quite new to c#, actually i'm working at an application localization. I've searched the web but still have some doubts.
Visual studio uses resx file to store string and generate a folder for each language-specific resx file (i.e. it-IT).
I need to fill a combobox with all available languages, that is an entry for each folder or resx file; there is an "easy" way to get this information? I can't find it.
Another issue is changing language at runtime, which implies the update of all Forms strings and the ones actually hardcoded (i.e MessageBox personalized strings).
Once the user has selected a language from the above combo, the apperance of the application should be adapted to the new language. There is a way to do such a thing other than call getstring for each item?
Thank you in advance
regards
sbit72
 
It should be like: (not tested)


using System.Globalization;

foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.UserCustomCulture))
{
this.listBox1.Items.Add(ci.ToString);
}

--------------

The files and folders you are talking about are created after you set the form's Localizable to TRUE and then change the language property. The DLLs have the control-associated globalized text that you type. If you want to display some messageboxes with culture-specific text, you will need to add assembly resources files to your project, with the format: <StandardName>.<culture>.resx, eg..
MyData.it-IT.resx
MyData.el-GR.resx

Hoe these help
 
Bad luck, i missed to say i'm working on framework 1.1 actually and there isn't CultureTypes.UserCustomCulture
Thank you anyway
 
that's how i've implemented it, there isn't a better way?

assemPath = assemPath.Substring(
0,(assemPath.LastIndexOf(@"\")+1));

foreach (CultureInfo CultInf in CultureInfo.GetCultures(
CultureTypes.AllCultures))
{
string[] exist = Directory.GetDirectories(
assemPath,CultInf.Name);
if(exist != null && exist.Length > 0)
{
cmbLangs.Items.Add(CultInf.EnglishName);
}
}
 
This way is ok.

My mistake... I opened quickly C# 2.0 (the express)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top