message localization
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
[703 byte] By [
George2] at [2007-11-20 11:36:30]

# 1 Re: message localization
You can build language specific module, one for each, thats what many people prefer.
If you want to ahve ability to detect and use it dynamically, then you can have all you strings mapped by some kind of offset, i.e. for english it will be like ID_STRERR + EN , for french ID_STRERR+FR, where EN, FR can be offsets.
There is one article here about this topic,
Library for MFC applications localization using resource-only DLLs (http://www.codeproject.com/useritems/Multilingual_Library.asp)
C++ Localization Techniques (http://www.lingobit.com/solutions/articles/c-localization.htm)
Tools,
RC Localization Tool (LocalizeRC) - The Code Project - Free Tools (http://www.codeproject.com/tools/localizerc.asp)
# 2 Re: message localization
Thanks for your 3 solutions Krishnaa!
For option 1, I can not use since I am not using MFC.
For option 2, seems it is commercial software? I need to develop by myself. ;)
For option 3, seems there is no built-in message localization functions in C++ if I am not using MFC and Visual Studio 2005? Could you help to confirm it please?
You can build language specific module, one for each, thats what many people prefer.
If you want to ahve ability to detect and use it dynamically, then you can have all you strings mapped by some kind of offset, i.e. for english it will be like ID_STRERR + EN , for french ID_STRERR+FR, where EN, FR can be offsets.
There is one article here about this topic,
Library for MFC applications localization using resource-only DLLs (http://www.codeproject.com/useritems/Multilingual_Library.asp)
C++ Localization Techniques (http://www.lingobit.com/solutions/articles/c-localization.htm)
Tools,
RC Localization Tool (LocalizeRC) - The Code Project - Free Tools (http://www.codeproject.com/tools/localizerc.asp)
regards,
George
# 3 Re: message localization
The links are not direct solution George, they are mere mechanism samples, try reading them, that information will help you do your localisation.