Home > Net >  DevExpress multilingual instant switching problem
DevExpress multilingual instant switching problem

Time:01-14

Refer to official document I implemented the program to switch in both Chinese and English: official offer package can only solve the default of parts, such as the Tip of the Close button, and WizardControl Next, Finish button switch Text;
As other SimpleButton names, with each Column in the GridControl Caption attribute value is the need to manually set,
Set up after the completion of the need to program entrance class to execute
 Thread. CurrentThread. CurrentCulture=new System. Globalization, CultureInfo (" useful - CN "); 

But this method must restart once take effect;

Is there any way I can change language directly, don't have to restart again?

CodePudding user response:

After I carried out the following code
 
//The following line provides localization for The application 's user interface.
CultureInfo culture=CultureInfo. CreateSpecificCulture (" useful - CN ");
Thread. The CurrentThread. CurrentUICulture=culture;

//The following line provides localization for data formats.
Thread. The CurrentThread. CurrentCulture=culture;

//Set this culture as the default culture for all threads in this application. The
//Note: The following properties are supported in The. NET Framework 4.5 +
CultureInfo. DefaultThreadCurrentCulture=culture;
CultureInfo. DefaultThreadCurrentUICulture=culture;

I perform again
 InitializeComponent (); 

Results Chinese interface, BUT and the overlap of the original, page layout the whole big confusion,
You have to solve the thinking of?
How to make the control on the premise of not restart to reload the language resource files?

CodePudding user response:

InitializeComponent(); This is initialization interface controls, has imposed a, must perform will mess,

Control does not restart, can try to hide the original interface, and changing the language, to the new one interface, can? Then Kill the old interface

CodePudding user response:

Try clear the cache?


Thread. The CurrentThread. CurrentUICulture=CultureInfo. GetCultureInfo (name);
Thread. The CurrentThread. CurrentUICulture. ClearCachedData ();
Thread. The CurrentThread. CurrentCulture=CultureInfo. GetCultureInfo (name);
Thread. The CurrentThread. CurrentCulture. ClearCachedData ();

CodePudding user response:

refer to the second floor of code of Einstein's reply:
InitializeComponent (); This is initialization interface controls, has imposed a, must perform will mess,

Control does not restart, can try to hide the original interface, and changing the language, to the new one interface, can? Then Kill the old interface


Less, because the interface is the initial interface;

Application. The Run (new FormStart ());

CodePudding user response:

The
reference 3 floor response: white flower
try clear the cache?


Thread. The CurrentThread. CurrentUICulture=CultureInfo. GetCultureInfo (name);
Thread. The CurrentThread. CurrentUICulture. ClearCachedData ();
Thread. The CurrentThread. CurrentCulture=CultureInfo. GetCultureInfo (name);
Thread. The CurrentThread. CurrentCulture. ClearCachedData ();

Also not line, because the end of the current Control has already been instantiated, only to change the current thread attributes of Culture doesn't work, I try to use the Control. The Refresh () method of traverse Control also not line, how to make the Control language configuration reload it!!
  •  Tags:  
  • C#
  • Related