473,405 Members | 2,354 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,405 software developers and data experts.

Localization - change language on the fly?

Can I change the language of an existing form on the fly?

Say I have two radiobuttons: "dutch" and "english". When the user
selects one, the form must switch to the selected language.
Is that possible and how?

When I set System.Threading.Thread.CurrentThread.CurrentUICul ture, any
new forms will use the new language. Existing forms keep their
language.

Hans Kesting
Jan 22 '07 #1
4 3739

this is possible but only in certain limits because you have to change
the locale of particular thread before the initialization of the form
components therefore its good before initialization of the foem
components u give optiond to user to select the language and then
depending on the user choice you change the locale of the language.
*** Sent via Developersdex http://www.developersdex.com ***
Jan 22 '07 #2

It is very easy.
This is a short example from one of my forms:
private void russianToolStripMenuItem_Click(object sender, EventArgs e)

{

Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru");

}

private void englishToolStripMenuItem_Click(object sender, EventArgs e)

{

Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");

}

private void italianToolStripMenuItem_Click(object sender, EventArgs e)

{

Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");

}
Of course your forms must support any of this cultures in their resourses.

"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:mn***********************@spamgourmet.com...
Can I change the language of an existing form on the fly?

Say I have two radiobuttons: "dutch" and "english". When the user
selects one, the form must switch to the selected language.
Is that possible and how?

When I set System.Threading.Thread.CurrentThread.CurrentUICul ture, any
new forms will use the new language. Existing forms keep their
language.

Hans Kesting


Jan 22 '07 #3
Sorry, Hans,
I've read your question not carefull.
I suppose you can't do it.
Jan 22 '07 #4
Hans Kesting wrote:
Can I change the language of an existing form on the fly?

Say I have two radiobuttons: "dutch" and "english". When the user
selects one, the form must switch to the selected language.
Is that possible and how?

When I set System.Threading.Thread.CurrentThread.CurrentUICul ture, any
new forms will use the new language. Existing forms keep their language.

Hans Kesting


Change the "CurrentUICulture" just will force the
"ResourceManager.GetString(..)" to return the string in specified
language. Hence, the new open form will load the correct language
strings since the form will call "ResourceManager.GetString(..)" when it
is opened.

It will not automatically change the strings which have been loaded in
the contorls. You need to make a function to reload the strings manually.

In my apps, it has a menu commands to change to different languages. In
the function, it will change the "CurrentUICulture" and then also call a
function to reload all the control strings. The function is basically
same to the "InitializeComponent()" which is generated by VisualStudio IDE.

--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
Jan 23 '07 #5

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

Similar topics

0
by: Joe | last post by:
I have a problem with an asp.net application that I think localization may be the answer. But it's not straight forward. My application has users log in and depending on which company and office...
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
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...
0
by: IcedCrow | last post by:
Greetings I have a localization question. I have set the localizable property of my form to true. I have selected French (Canada) as my language. I have changed the text properties...
2
by: Corvus | last post by:
We have a significant ASP.Net web application I am considering localizing to Spanish. All the .aspx and .aspx.cs files have hard-coded English. The issue is that we are a small company without...
0
by: gen | last post by:
Hi everybody, We would like to use localization in order to translate our applications. The working environment of the users is very bilingual so they often have to switch from one language to...
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...
2
by: Robert Dufour | last post by:
In an english only application, it is fairly easy to make the table and field names in your application descriptive so that on creating the interface, most tools that bind data take the default...
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.