Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Mulilanguage Windows Application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ehab Zaky - 03 Sep 2004 12:53 GMT
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??
Derrick [MCSD] - 03 Sep 2004 14:19 GMT
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

> Dear All,
>
[quoted text clipped - 12 lines]
>
> How could I do that??
Jacky Kwok - 04 Sep 2004 02:37 GMT
> Dear All,
>
[quoted text clipped - 12 lines]
>
> 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().

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.