Click here to Skip to main content
15,881,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

Im developing a windows mobile application(6.0) and im using two resource files,for two languages. I load the resource file on load of each form,and it takes a little time to load,when the forms have a lot of labels,or textboxes.

this is the function i use to set the language,and i call it when form loads.
C#
public static void ChangeLanguage(Form forma)
       {
           foreach (Control c in forma.Controls)
           {
               ComponentResourceManager resources = new ComponentResourceManager(forma.GetType());
               resources.ApplyResources(c, c.Name, new CultureInfo(glob_lang));
           }
       }


Is there any other way to do this,for example set the language in the main form(for all application),and the other forms dont need to call the function anymore?

Thanx in advance!
Posted
Updated 20-Sep-12 21:08pm
v2

1 solution

Add this to entry point(Main, usually in Program.cs, static void Main()):
C#
Thread.CurrentThread.CurrentCulture = new CultureInfo(glob_lang); 


Also try Localisation :
.NET - Localization using Resource file[^]
 
Share this answer
 
v3
Comments
IviKAZAZI 20-Sep-12 3:55am    
Yes i have read about it,but then i have to set the variables for each textbox,label etc,and there are a lot of it. I use the visualstudio language properties to create the resource files.
Kuthuparakkal 20-Sep-12 4:03am    
updated soln try.
IviKAZAZI 20-Sep-12 4:07am    
i have tried that too,but the CurrentCulture method doesnt exist in mobile developement.
Kuthuparakkal 20-Sep-12 4:15am    
may this help you:
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=16091

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