NO

Author Topic: Multi language example for console program.  (Read 3027 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Multi language example for console program.
« on: May 11, 2016, 11:18:56 AM »
Simple multi language example for console program.
I can't recall if is it shown before?
Code: [Select]
#include <stdio.h>
#include <stdlib.h>

char *aMsgEN[] = {"MsgEN1\n","MsgEN2\n"};
char *aMsgGE[] = {"MsgGE1\n","MsgGE2\n"};
char **aMsg = aMsgEN;
int main(int argc, char **argv)
{
char *lang = getenv("LANG");
printf(aMsg[0]);
printf("%s %04X\n", lang, *(unsigned short*)lang);
//if (lang[0] == 'G' && lang[1] == 'E') {
if (*(unsigned short*)lang == *(unsigned short*)"GE") {
aMsg = aMsgGE;
printf(aMsg[0]);
}
return 0;
}
May the source be with you