More tweaking on stamps handling of fallback languages

This commit is contained in:
Pere Pujal i Carabantes 2014-08-13 23:09:56 +00:00
parent 202fc69320
commit b9a8a05618

View file

@ -10714,18 +10714,22 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
#endif #endif
if (extptr != NULL) if (extptr != NULL)
{
found = 0;
/* Set the first available language */
for(i = 0; i < num_wished_langs && !found; i++)
{ {
strcpy((char *) extptr, ".txt"); strcpy((char *) extptr, ".txt");
fi = fopen(txt_fname, "r"); fi = fopen(txt_fname, "r");
free(txt_fname);
if (!fi) if (!fi)
return NULL; return NULL;
got_first = 0; got_first = 0;
found = 0; // found = 0;
strcpy(def_buf, ""); strcpy(def_buf, "");
@ -10736,7 +10740,7 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
if (!feof(fi)) if (!feof(fi))
{ {
strip_trailing_whitespace(buf); strip_trailing_whitespace(buf);
printf("buf %s\n", buf);
if (!got_first) if (!got_first)
{ {
@ -10749,11 +10753,8 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
debug(buf); debug(buf);
/* Set the first available language */
for(i = 0; i < num_wished_langs; i++)
{
// lang_prefix = lang_prefixes[langint];
// lang_prefix = lang_prefixes[langint];
/* See if it's the one for this locale... */ /* See if it's the one for this locale... */
if ((char *) strcasestr(buf, wished_langs[i].lang_prefix) == buf) if ((char *) strcasestr(buf, wished_langs[i].lang_prefix) == buf)
@ -10782,11 +10783,13 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
} }
} }
} }
}
while (!feof(fi) && !found); while (!feof(fi) && !found);
fclose(fi); fclose(fi);
}
free(txt_fname);
/* Return the string: */ /* Return the string: */