I am working on an assignment where I need to localise the Software written in C++ on Windows OS. I followed the steps you mentioned. I could generate the PO files and MO files. As an experiment, I have written Translated strings myself to some other text in english itself. And I generated the MO file and copied to the folder.C:\Program files\GnuWin32\share\locale\en\LC_MESSAGES
Here is my Source code:
int _tmain(int argc, _TCHAR* argv[]) { char buf1[100]; // BOOL ret = SetEnvironmentVariable(L"LANGUAGE", L"en"); char* locale = setlocale( LC_ALL, "" );
bindtextdomain( "TestApp1", "C:\\Program File\\Gnu Win32\\share\\locale" ); textdomain( "TestApp1" ); sprintf (buf1, "%d", 123); printf (gettext ("The amount is %s\n"), buf1);
printf (gettext ("Hello.. How r u ?\n"), buf1); getchar(); return 0; }
Translated string in MO file looks like this: Translated:The amount is %s\n Translated:Hello.. How r u
After this I suppose when I execute the programs, I should be getting output as the Translated messages Translated:The amount is %s\n Translated:Hello.. How r u
But I am getting the original messages not Translated messages. Note that I have set the LOCALE env variable as en_GB
Please me know if I am missing any steps. What should I do to get Translated messages as output ?