Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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.4K
Edited 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 at 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 at 20-Sep-12 4:03am
   
updated soln try.
IviKAZAZI at 20-Sep-12 4:07am
   
i have tried that too,but the CurrentCulture method doesnt exist in mobile developement.
Kuthuparakkal at 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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 397
1 OriginalGriff 350
2 thatraja 205
3 Emre Ataseven 165
4 Shai Vashdi 150
0 Sergey Alexandrovich Kryukov 8,894
1 OriginalGriff 5,200
2 Peter Leow 3,955
3 Maciej Los 3,535
4 Abhinav S 3,208


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid