putenv("");
Code: Select all
#include <locale.h>
#include <libintl.h>
#define PACKAGE "hello3"
#define LOCALEDIR "locale"
import "ecere"
#define _(STRING) gettext(STRING)
class HelloApp : Application
{
void Main()
{
char* lang="en"; //change lang's value get the different language translations
putenv("LANG=zh_CN");
setlocale(LC_ALL, "zh_CN");
if ("cn" == lang) {
putenv("LANG=zh_CN");
setlocale(LC_ALL, "zh_CN");
} else if ("tw" == lang) {
putenv("LANG=zh_TW");
setlocale(LC_ALL, "zh_TW");
} else if ("en" == lang) {
putenv("LANG=en_US");
setlocale(LC_ALL, "en_US");
}
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
printf(_("this is a string\n"));
system("pause");
}
}