Dear all,
My application allows users to switch languages at run time. I use the
following code to change the UI Culture but all controls are remaining
unchanged.
Thread.CurrentT hread.CurrentUI Culture = new CultureInfo("en-US");
Why? Anything that I need to do in order to refresh the controls?
Thanks for any help!
Tedmond 4 16771
Tedmond wrote: Dear all,
My application allows users to switch languages at run time. I use the following code to change the UI Culture but all controls are remaining unchanged.
Thread.CurrentT hread.CurrentUI Culture = new CultureInfo("en-US");
Why? Anything that I need to do in order to refresh the controls?
Thanks for any help!
Tedmond
Change "CurrentUICultu re" will not automatically take effect in all UI
control.
Change "CurrentUICultu re" just affect some APIs which are releated to
localization.
For example, "System.Resourc es.ResourceMana ger.GetString(. ..)", then it
will use the current "CurrentUICultu re" to load suitable string resources.
For Windows.Form UI control, you need to reload all the resource strings
after change the "CurrentUICultu re".
--
Jacky Kwok
jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk
jacky@compose_D OT_com_DOT_hk
Hi Jacky,
I tried to call InitializeCompo nent() again after changing the
CurrentUICultur e. I found it reload all the resource strings and all the
values are updated, however the display remains unchanged. Why? For
example, when I debug the program I found a button .Text property is updated
after changing the CurrentUICultur e but the screen still showing the original
language.
Any more idea?
Thanks.
"jacky kwok" wrote: Tedmond wrote: Dear all,
My application allows users to switch languages at run time. I use the following code to change the UI Culture but all controls are remaining unchanged.
Thread.CurrentT hread.CurrentUI Culture = new CultureInfo("en-US");
Why? Anything that I need to do in order to refresh the controls?
Thanks for any help!
Tedmond
Change "CurrentUICultu re" will not automatically take effect in all UI control.
Change "CurrentUICultu re" just affect some APIs which are releated to localization. For example, "System.Resourc es.ResourceMana ger.GetString(. ..)", then it will use the current "CurrentUICultu re" to load suitable string resources.
For Windows.Form UI control, you need to reload all the resource strings after change the "CurrentUICultu re".
-- Jacky Kwok jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk jacky@compose_D OT_com_DOT_hk
Tedmont,
The culture settings are affected to the culture setting as decimal point
and datetime representation, not direct to the used language. Because these
cultures can be depended from the language used in those countries is the
complete culture setting needed. (Think by instance to Canada, which uses
the culture from French and from England (not from the USA)).
Cor
Tedmond wrote: Hi Jacky,
I tried to call InitializeCompo nent() again after changing the CurrentUICultur e. I found it reload all the resource strings and all the values are updated, however the display remains unchanged. Why? For example, when I debug the program I found a button .Text property is updated after changing the CurrentUICultur e but the screen still showing the original language.
Hi Tedmond:
I do not sure what is your problem.
In my own app, it works.
Moreover, you should not call "InitializeComp onent()" directly. The VS
generated "InitializeComp onent()" not only loads string resource but
also creates all the child controls.
I believe it will raise exception when you call it again.
You should copy the code in "InitializeComp onent()" which are related to
the localization resource in another function.
/// It is my example i na Form "FormMain"
.....
System.Threadin g.Thread.Curren tThread.Current UICulture = new
System.Globaliz ation.CultureIn fo(lang); //my selected lang from menu
ReloadControlSt ring();
///
private void ReloadControlSt ring()
{
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(FormM ain));
this.menuApp.Te xt = resources.GetSt ring("menuApp.T ext");
.........
}
///
Make sure you have made the correct localization resource for your
control. You can use debugger to check what string is loaded.
--
Jacky Kwok
jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk
jacky@compose_D OT_com_DOT_hk
Any more idea?
Thanks.
"jacky kwok" wrote:
Tedmond wrote: Dear all,
My application allows users to switch languages at run time. I use the following code to change the UI Culture but all controls are remaining unchanged.
Thread.CurrentT hread.CurrentUI Culture = new CultureInfo("en-US");
Why? Anything that I need to do in order to refresh the controls?
Thanks for any help!
Tedmond Change "CurrentUICultu re" will not automatically take effect in all UI control.
Change "CurrentUICultu re" just affect some APIs which are releated to localization. For example, "System.Resourc es.ResourceMana ger.GetString(. ..)", then it will use the current "CurrentUICultu re" to load suitable string resources.
For Windows.Form UI control, you need to reload all the resource strings after change the "CurrentUICultu re".
-- Jacky Kwok jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk jacky@compose_D OT_com_DOT_hk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DraguVaso |
last post by:
Hi,
I have a Windows Service running (made in VB.NET), and wanted to be able to
change from time to time some parameters by changing them in the App.config.
But it seems that the application doesn't use the changed values in the
App.config, but continue to use the values that were there during start-up.
Is there a way to let the application use the new values in the App.config?
Is there kind of some 'refresh' function that I should...
|
by: Amy |
last post by:
What's different between Controls method Refresh() and
Invalidate(), Refresh() and Update()?
Your help will be appreciated. Thanks.
|
by: John |
last post by:
Hi.
When I use VB.NET projects, Visual Studio refreshes the display when I
correct errors. (i.e. removes the blue and red lines under syntax errors
etc.)
But when I use C# projects, the display doesn't refresh until I do a build,
or a "View in browser". Can anyone help or have advice? This is VERY
frustrating for a beginner like myself having to rebuild every time I TRY to
correct something just to see if my syntax errors are fixed....
|
by: TS |
last post by:
Im in a web page and call an asynchronous method in business class. the call
back method is in the web page.
When page processes, it runs thru code begins invoking the method then the
page unloads. When the callback method is raised, only the method in the web
page is run and the page never refreshes, it seems it all happens on the
server side.
I am trying to refresh the constrols on the page inside the callback method,
but when id...
|
by: Ned Balzer |
last post by:
Hi,
Apologies if this is a newbie question, I haven't found the answer in
any faqs.
I have an asp.net 2.0 page that sets session variables and then
redirects to another page. For the page that gets redirected to, I've
swapped in a simple page for testing that reads the session variables
and displays their values.
| |
by: Orit |
last post by:
Hi .
I am creating an ASP.NET 2.0 web site and have the following problem :
1. I have a GridView which bound to the object data source.
2. This object data source is SQL Table adapter that I added to the
data set via IDE .
3. The method GetData of this table adapter uses existing stored
procedure on my SQL 2005 server.
4. Everything worked fine , until I made a changes to the stored
|
by: seanmatthewwalsh |
last post by:
Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |