4 static const char* AvailLang[]=
11 /* TODO: we skip the language weightening so far. */
12 /* Accept-Language: 'de-de,en-us;q=0.7,en;q=0.3' */
13 void httplang_to_locale(const char* LocaleString)
16 char *wanted_locales[10];
19 size_t len=strlen(LocaleString);
22 char *search=(char*)malloc(len);
25 char *webcitdir = WEBCITDIR;
27 memcpy(search,LocaleString,len);
30 /* the web browser sends '-', we need '_' */
32 if (search[i]=='-') search[i]='_';
34 while ((search[i]!='\0')&&
38 if ((search[i]==',')||(search[i]==';'))
41 if (search[i]==';') done=1;
43 wanted_locales[nFound]=(char*)&search[j];
52 for (i=0; i<=nFound; i++)
54 for (j=0;j<nAvail; j++)
56 int ret=strncasecmp(wanted_locales[i],
58 strlen(wanted_locales[i]));
61 locale=AvailLang[j];//wanted_locales[i];
69 setlocale(LC_ALL,"C");
71 memcpy(search,locale,len);
72 memcpy(&search[len],".UTF8",5);
77 memcpy(mo,search,len+1);
80 mo = malloc(strlen(webcitdir) + 20);
81 sprintf(mo, "%s/locale", webcitdir);
83 lprintf(9, "Message catalog directory: %s\n",
84 bindtextdomain("webcit", mo)
88 lprintf(9, "Text domain: %s\n",
92 lprintf(9, "Text domain Charset: %s\n",
93 bind_textdomain_codeset("webcit","UTF8")
97 //setlocale(LC_MESSAGES,mo);//search);
98 setlocale(LC_MESSAGES,search);