message localization

G

Guest

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
 
M

Mihai N.

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top