Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
win7 64+VS2008
I wrote a simple gettext test procedures are as follows:
C
#include <stdio.h> 
#include <locale.h> 
#include "libintl.h" 
#include <windows.h> 
#pragma comment(lib,"libintl.lib") 
#define _(S) gettext(S) 
#define PACKAGE "hello" 
int main(int argc, char **argv) 
{ 
char tmp[51]= {0}; 
int t; 
char path[MAX_PATH]= {0}; 
_snprintf(tmp, 51, "LANG=%s", argv[1]); 
t=putenv(tmp); 
bindtextdomain(PACKAGE, "locale"); 
//bind_textdomain_codeset(PACKAGE,"UTF-8"); 
textdomain(PACKAGE); 
printf(_("Hello!")); 
return 0; 
} 

And then build Hello.Po, translation in the generated Hello.Mo file separately
Placed in the following location:
.\Debug\locale\zh_TW\LC_MESSAGES\hello.mo 
.\Debug\locale\zh_CN\LC_MESSAGES\hello.mo 
.\Debug\locale\ja\LC_MESSAGES\hello.mo 
.\Debug\locale\en_US\LC_MESSAGES\hello.mo 
.\Debug\hello.exe 
.\Debug\libiconv2.dll 
.\Debug\libintl3.dll 
Then you run Hello.exe zh_TW (Hello.exe ja Hello.exe en_US) show all Chinese instead of the appropriate language。\Debug\locale\ja\LC_MESSAGES\hello.mo,.\Debug\locale\en_US\LC_MESSAGES\hello.mo,
.\Debug\locale\zh_TW\LC_MESSAGES\hello.mo
Copy respectively. under \Debug\locale\zh_CN\LC_MESSAGES\ was able to copy the appropriate language is displayed。
Is unable to switch the interface language, toggle the display of all Chinese,why is this?
Posted
Updated 3-Sep-14 22:58pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900