Hello,
I'm trying to write a localized program like official add-ins, but I don't know how to detect the system's locale settings. Is there any syscall that can give me such kind of information?
Thanks.
Whilst there's no known syscall to do this, the first localised message in each language is the name of the language. Thus, you could do the following to detect if the language is English:

Code:
char language[256];

LocalizeMessage1(1, language);
if (strcmp(language, "English") == 0) {
    // It's English!
}


The same can be done for any other language. Note that this returns a multi-byte string, so the following could be done to detect Chinese:

Code:
char language[256];

LocalizeMessage1(1, language);
if (strcmp(language, "\xd6\xd0\xce\xc4") == 0) {
    // It's Chinese!
}
dr-carlos wrote:
Whilst there's no known syscall to do this, the first localised message in each language is the name of the language. Thus, you could do the following to detect if the language is English:

Code:
char language[256];

LocalizeMessage1(1, language);
if (strcmp(language, "English") == 0) {
    // It's English!
}


The same can be done for any other language. Note that this returns a multi-byte string, so the following could be done to detect Chinese:

Code:
char language[256];

LocalizeMessage1(1, language);
if (strcmp(language, "\xd6\xd0\xce\xc4") == 0) {
    // It's Chinese!
}


Thanks! It worked.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement