- wanted_locales[i].Priority=1.0;
- }
- /* get the locale part */
- extract_token(&sbuf[0],&buf[0],0,';',16);
- /* get the lang part, which should be allways there */
- extract_token(&wanted_locales[i].lang[0],&sbuf[0],0,'-',16);
- /* get the area code if any. */
- if (num_tokens(&sbuf[0],'-')>1) {
- extract_token(&wanted_locales[i].region[0],&sbuf[0],1,'-',16);
- }
- else { /* no ara code? use lang code */
- blen=strlen(&wanted_locales[i].lang[0]);
- memcpy(&wanted_locales[i].region[0], wanted_locales[i].lang,blen);
- wanted_locales[i].region[blen]='\0';
- } /* area codes are uppercase */
- blen=strlen(&wanted_locales[i].region[0]);
- for (j=0; j<blen; j++)
- {
- int chars=toupper(wanted_locales[i].region[j]);
- wanted_locales[i].region[j]=(char)chars;/*todo ?! */
- }
- }
-
- /* todo: weight */
- if (nFound > 0) {
- for (i = 0; i <= nFound; i++) {
- for (j = 0; j < nAvail; j++) {
- int ret = strncasecmp(&wanted_locales[i].lang[0],
- AvailLang[j],
- strlen(&wanted_locales[i].lang[0]));
- if (!ret) {
- locale = (char *) AvailLang[j]; //wanted_locales[i];
- i = nFound + 1;
- j = nAvail + 1;
- continue;
- }
-
- }