Mihai N. schrieb:
Michael Nesslinger schrieb:
Found the error myself.
[..]
> 7. Compiled the French resx file with the following command:
> ResGen.exe Form1.fr-FR.resx
[quoted text clipped - 4 lines]
> /out:bin\Debug\fr-FR\InternationalApplication.resources.dll
> /embed:Form1.fr-FR.resources
This line has to be changed to:
/embed:Form1.fr-FR.resources,InternationalApplication.Form1.fr-FR.resources
> /template:bin\Debug\InternationalApplication.exe
[..]
The method for changing the language should be altered to the following:
> private void button1_Click(object sender, EventArgs e)
> {
Point ps = this.Location;
Size sz = this.Size;
> CultureInfo info = new
> CultureInfo(Path.GetFileName((String)cultures[this.toolStripComboBox1.SelectedItem.ToString()]));
>
> Thread.CurrentThread.CurrentUICulture = info;
>
> this.Controls.Clear();
this.Events.Dispose();
> InitializeComponent();
> MoreInitialisation();
this.Location = ps;
this.Size = sz;
> }
The saving and setting of position and size of the Form is only of some
cosmetic value. But disposing the events is something vital because if
you do not call dispose and keep switching languages the old events are
still there and that is not what we want.
Maybe simply disposing them is not practical in all cases, but you
should get rid of them either by just disposing them or processing them.
Now it works as expected. Thanks to all who helped.
Michael Neßlinger
Michael S. Kaplan [MSFT] - 14 Jun 2007 12:31 GMT
Note that by saving the position and size of controls you actually make the
localization story worse for languages where a localizer changes the layout
for cultural reasons or the size to avoid text clipping.
These properties are considered localizable for a reason; this code ignores
that....

Signature
MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap
This posting is provided "AS IS" with
no warranties, and confers no rights.
> Michael Nesslinger schrieb:
>
[quoted text clipped - 48 lines]
>
> Michael Neßlinger
Michael Nesslinger - 14 Jun 2007 18:14 GMT
Michael S. Kaplan [MSFT] schrieb:
> Note that by saving the position and size of controls you actually make the
> localization story worse for languages where a localizer changes the layout
> for cultural reasons or the size to avoid text clipping.
>
> These properties are considered localizable for a reason; this code ignores
> that....
Yes, you are right. This should not be done with any control at any
time. You have to think carefully about it. I only used it here to keep
the window where the user might have moved it to.
But thanks for this advice.
Michael Neßlinger