473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Localization in C#

SDK
Hello,

I've written a little program in C# to test localization. It's one form
with a label and a button. I've included two languages into my form (Dutch
and English) using localization. In the main function, the culture is set
to dutch, and it all looks fine. But when I change the culture (by pressing
the button), I get a mix of the english resx and the dutch resx. My button
gets duplicated instead of moved, and my label keeps showing the dutch text
instead of the english one. When I show a messagebox with the contents of
my label, the English text is shown ?!

This is the code executed when the button is pressed:

System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo("en-US") ;
InitializeComponent();

So my question is:
Can I change the culture at runtime and expect an emmediate change on the
form. By executing a refresh method for instance. What am I doing wrong?

Remark:
It works fine when I change the culture and open a new form.
Thanks for your help...



Nov 16 '05 #1
1 9191
When you call InitializeComponent(), you're adding all the controls to the
form. Unless you've previously removed all the controls from the form,
you'll get duplicates. Really, it's best to close the form and re-open it,
but you can also simply remove all the controls from the form and ten call
InitializeComponent().

Pete

"SDK" <fa**@fake.com> wrote in message
news:40**********************@news.skynet.be...
Hello,

I've written a little program in C# to test localization. It's one form
with a label and a button. I've included two languages into my form (Dutch and English) using localization. In the main function, the culture is set
to dutch, and it all looks fine. But when I change the culture (by pressing the button), I get a mix of the english resx and the dutch resx. My button gets duplicated instead of moved, and my label keeps showing the dutch text instead of the english one. When I show a messagebox with the contents of
my label, the English text is shown ?!

This is the code executed when the button is pressed:

System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo("en-US") ;
InitializeComponent();

So my question is:
Can I change the culture at runtime and expect an emmediate change on the
form. By executing a refresh method for instance. What am I doing wrong?

Remark:
It works fine when I change the culture and open a new form.
Thanks for your help...


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Amin Schoeib | last post by:
Hi, I am a Postgres newbie who worked until now with Oracle. Now I want to know if it is possible (when yes the how?) in Postgresql To set dynamically the Localization? For example in Oracle you...
6
by: Rental | last post by:
I'm having the sam problem as described below with the Localization toolkit. Does anyone know if there is a solution to this problem. --->When attempting to generate resource dlls with...
2
by: Julia | last post by:
Hi, We want to migrate out asp application to asp.net and take advantage on localization. I want to ask how it is advice to structure the site directory I am going to use resource only...
8
by: Olivier Matrot | last post by:
I encounter a problem with Localization features in ASP.NET 2.0. Is seems that the framework is not able to manage neutral cultures such as 'fr', or 'de'. Those are the culture sent by default from...
5
by: CMM | last post by:
I don't seem to "get" ASP.NET 2.0's Localization features. I've read up on everything... and of course, everything is explained in cursory softball terms- not any "real-world" usage way. I hope...
2
by: bruno | last post by:
I need to localize my ASP.NET app and I just used "Tools" --"generate local resources" command and everything works fine in my WebForms. Resource file name is: MyWebForm.aspx.resx under a subDir...
0
by: shapper | last post by:
Hello, Sometime ago I followed an article (I believe MSDN) related with localization in Asp.Net 2.0. To make pages localization I create a class named Localization: 1 Public Class...
3
by: Corey B | last post by:
I have an ASP.NET application that was built in ASP.NET v1.1. It has a SQL Server back end database. I have been asked to provide an estimate for the level of effort required to produce a Chinese...
3
by: Computer Guru | last post by:
I have a VB.NET 2005 application with several forms and a couple hundred "strings." I've been looking into all the localization improvements in VB.NET, and I can't seem to find anything that...
2
Leito
by: Leito | last post by:
Hi, I am currently developping (under Visual Studio Express 2008) an application for which I'd like to have several languages available. That's why, after a few hours of search, I decided to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.