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??

Re: Mulilanguage Windows Application by Derrick

Derrick
Fri Sep 03 08:19:44 CDT 2004

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


"Ehab Zaky" <ehabzaky@engineer.com> wrote in message
news:u7s8uyakEHA.2504@TK2MSFTNGP14.phx.gbl...
> 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??
>
>



Re: Mulilanguage Windows Application by Jacky

Jacky
Fri Sep 03 20:37:45 CDT 2004

Ehab Zaky wrote:
> 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??
>
>


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().


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