Click here to Skip to main content
12,508,470 members (54,434 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET3.5 C# .NET Visual-Studio , +
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.
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 19-Sep-12 21:46pm
IviKAZAZI1.5K
Updated 20-Sep-12 21:08pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

Also try Localisation :
.NET - Localization using Resource file[^]
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100