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 / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

message localization

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 23 Oct 2007 10:39 GMT
Hello everyone,

I want to print out and log localized message according to current locale of
machine. For example, if I am always use MESSAGE_ERROR macro in my program,
and I want to replace it with "Error" when the locale is en_US and be
replaced with French if the locale if Fr.

I am wondering whether Visual Studio 2005 provide some existing technology
or some resource file which I could utilize? For example, I could define
MESSAGE_ERROR macro to "error" if locale is English and define to other
values if other locale is set. I do not want to change any source codes if
necessary. I am developing unmanaged C++ DLL using Visual Studio 2005.

thanks in advance,
George
Crest Teethgel - 23 Oct 2007 23:32 GMT
> I am wondering whether Visual Studio 2005 provide some existing technology
> or some resource file which I could utilize? For example, I could define

A Message Compiler could be use for that purpose.

http://msdn2.microsoft.com/en-us/library/aa385633.aspx

cordialy,

Crest
George - 24 Oct 2007 06:19 GMT
Thanks Crest,

Good links!

regards,
George

> > I am wondering whether Visual Studio 2005 provide some existing technology
> > or some resource file which I could utilize? For example, I could define
[quoted text clipped - 6 lines]
>
> Crest
Mihai N. - 24 Oct 2007 02:34 GMT
> I want to print out and log localized message according to current locale of
> machine. For example, if I am always use MESSAGE_ERROR macro in my program,
[quoted text clipped - 6 lines]
> values if other locale is set. I do not want to change any source codes if
> necessary. I am developing unmanaged C++ DLL using Visual Studio 2005.

Create a resource file, with string tables.
Then you can load the string using ... LoadString :-)
You can use resources to localize dialogs, menus, icons and bitmaps, a lot of
stuff beyond plain strings.

The best practice is to create resource-only DLLs (or satelite DLLs), one per
language. Then you load the one you need (LoadLibrary) and load the resources
from there.

A good place to start: http://msdn2.microsoft.com/en-us/library/ms776201.aspx
Although it looks like Vista only, some of the stuff also applies to previous
versions, see http://msdn2.microsoft.com/en-us/library/aa365002.aspx

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

George - 24 Oct 2007 06:20 GMT
Thanks for your comprehensive answer Mihai!

regards,
George

> > I want to print out and log localized message according to current locale
> of
[quoted text clipped - 20 lines]
> Although it looks like Vista only, some of the stuff also applies to previous
> versions, see http://msdn2.microsoft.com/en-us/library/aa365002.aspx

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.