Dear All,
I'm developing a Multilanguage application using C# that supports English
and French and Arabic.
I have created the Forms with the default language and changed the language
to each of the languages that I want to support and do any locale specific
changes. Now I have each Form with all its resources needed for all
languages I want to support.
I want to put menu items that switch the application interface
instantaneously between languages that the application support without
restating the application.
I have tried to change the current thread CultureUI to the new culture then
call the InitializeComponent() method but it gives strange results.
How could I do that??
Derrick [MCSD] - 03 Sep 2004 14:19 GMT
Hi Ehab,
The UI culture must be set (from an app.config file, or in an initialization
form) before a form displaying any localized resources is loaded . This
allows the appropriate resources to be retrieved during the actual loading
of the localized form.
HTH,
Derrick
> Dear All,
>
[quoted text clipped - 12 lines]
>
> How could I do that??
Jacky Kwok - 04 Sep 2004 02:37 GMT
> Dear All,
>
[quoted text clipped - 12 lines]
>
> How could I do that??
You should not call the InitializeComponent() directly.
InitializeComponent() will create and initizlize all controls.
You just need to reload all the resourse strings.
You can refer your InitializeComponent() function
e.g. your InitializeComponent() has
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(FormXXXX));
this.label1 = new System.Windows.Forms.Label();
this.label1.AccessibleDescription =
((string)(resources.GetObject("label1.AccessibleDescription")));
this.label1.AccessibleName =
((string)(resources.GetObject("label1.AccessibleName")));
......
this.label1.Text = resources.GetString("label1.Text");
......
}
Then you can implement a function
void ReloadResource()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(FormXXXX));
this.label1.Text = resources.GetString("label1.Text");
......
}
i.e. your function just need to reload the string with Multilanguage
localization necessary.
Then, after you set the thread CultureUI , call the ReloadResource().

Signature
Jacky Kwok
jacky@alumni.cuhk.edu.hk
jacky@compose.com.hk