5 static const char* AvailLang[]=
12 /* TODO: we skip the language weightening so far. */
13 /* Accept-Language: 'de-de,en-us;q=0.7,en;q=0.3' */
14 void httplang_to_locale(const char* LocaleString)
17 char *wanted_locales[10];
20 size_t len=strlen(LocaleString);
23 char *search=(char*)malloc(len);
26 // char *webcitdir = WEBCITDIR;
28 locale_t my_Empty_Locale;
29 memcpy(search,LocaleString,len);
32 /* the web browser sends '-', we need '_' */
34 if (search[i]=='-') search[i]='_';
36 while ((search[i]!='\0')&&
40 if ((search[i]==',')||(search[i]==';'))
43 if (search[i]==';') done=1;
45 wanted_locales[nFound]=(char*)&search[j];
54 for (i=0; i<=nFound; i++)
56 for (j=0;j<nAvail; j++)
58 int ret=strncasecmp(wanted_locales[i],
60 strlen(wanted_locales[i]));
63 locale=(char*)AvailLang[j]; //wanted_locales[i];
73 memcpy(search,locale,len);
74 memcpy(&search[len],".UTF8",5);
76 my_Empty_Locale=newlocale(LC_ALL_MASK, NULL, NULL); /* create default locale */
77 my_Locale=newlocale(LC_MESSAGES_MASK/*|LC_TIME_MASK TODO */,
82 //freelocale(my_Locale);
83 // freelocale(my_Empty_Locale);