diff --git a/misc/main.c b/misc/main.c index 830f9845d7..7f16805ed0 100644 --- a/misc/main.c +++ b/misc/main.c @@ -32,6 +32,7 @@ #include "debugdefs.h" #include "xmalloc.h" #include "version.h" +#include "winnls.h" /* when adding new languages look at ole/ole2nls.c * for proper iso name and Windows code (add 0x0400 @@ -326,6 +327,356 @@ static BOOL32 MAIN_ParseDebugOptions(char *options) return TRUE; } +/*********************************************************************** + * MAIN_GetLanguageID + * + * INPUT: + * Lang: a string whose two first chars are the iso name of a language. + * Country: a string whose two first chars are the iso name of country + * Charset: a string defining the chossen charset encoding + * Dialect: a string defining a variation of the locale + * + * all those values are from the standardized format of locale + * name in unix which is: Lang[_Country][.Charset][@Dialect] + * + * RETURNS: + * the numeric code of the language used by Windows (or 0x00) + */ +int MAIN_GetLanguageID(char *Lang, char *Country, char *Charset, char *Dialect) +{ + char lang[3]="??", country[3]={0,0,0}; + char *charset=NULL, *dialect=NULL; + int i,j,ret=0; + + if (Lang==NULL) return 0x00; + if (Lang[0]) lang[0]=tolower(Lang[0]); + if (Lang[1]) lang[1]=tolower(Lang[1]); + + if (Country!=NULL) { + if (Country[0]) country[0]=toupper(Country[0]); + if (Country[1]) country[1]=toupper(Country[1]); + } + + if (Charset!=NULL) { + j=strlen(Charset); + charset=(char*)malloc(j+1); + for (i=0;i 0x56 +/*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI ) + LANG_ENTRY_END( KONKANI ) */ +// 0x58 -> ... + LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */ + LANG_ENTRY_END( ESPERANTO ) + + ret = LANG_NEUTRAL; + +end_MAIN_GetLanguageID: + if (Charset) free(Charset); + if (Dialect) free(Dialect); + + return ret; +} + /*********************************************************************** * MAIN_ParseLanguageOption *