how to use localized string?

Posted on 2009-05-27
Medium Priority
Last Modified: 2013-11-07
In my application, I need to localize both GUI and the string that will be displayed whenever an error occurs. I have already finished localizing the GUI using the IDE. Now, I'm having a problem on how to do that with the messages. In the previous version, I used an INI file to read both english and japanese texts.

previous :
string msg = Ini.Read("ENGLISH",ERROR_1);

what i am thinking :
1. Create additional resource file but dont know how to connect it to the application
2. If I create a new resource file, does it automatically merges with the Language DLL which is created from localizing the GUI

Could you please tell me how to deal with this?
If possible, please provide steps

Question by:margajet24
  • 3
  • 2

Expert Comment

ID: 24490042

What you need to do is set CurrentCulture, which can be done in asp.net page directive or programatically. This can also automaticaly be changed accordingly to the language specified in the browser. Based on this asp.net selects the appropiated resource file.

Look at this link:
How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization

You can find more information here:
Localizing ASP.NET Web Pages By Using Resources

Hope that it helps
LVL 10

Author Comment

ID: 24490218
Thank you for your quick response Mighty_Joe.

I am developing a Windows Application. Do you have any references for this?


Expert Comment

ID: 24495153
Hey again

It is very similar to ASP.NET you add a resource file for each language (and name it appropiate) and set the CurrentUICulture on the current thread.
Then on each control, lable, button and so forth you should set the property Localiseable = true and the name of the control is also the name of the field in the resource file.

See this link:
Globalizing and Localizing Windows Application, Part 2 or this one How to Localize Windows Forms and Change the Language at Runtime for eksampels.

LVL 10

Author Comment

ID: 24499086
i know how to do it in GUI but what I want to is, localizing the text/strings that will be displayed.

in ini file ,

ERROR_1 = error

ERROR_1 = ¨éü

Accepted Solution

Mighty_Joe earned 500 total points
ID: 24501518
Okay i see what you mean.. Try this:

ComponentResourceManager mgr = new ComponentResourceManager(typeof(Form1));
string localString = mgr.GetString("ERROR1", System.Threading.Thread.CurrentThread.CurrentCulture);

Remeber to set the CulturInfo to the Thread first..

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question