Removing loaddesc() debugging

Things look fine here. Not actually finding languages in i18n,
it seems!
This commit is contained in:
Bill Kendrick 2020-07-26 16:52:05 -07:00
parent 42512a67b0
commit ac755bf26c

View file

@ -10987,15 +10987,6 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
extptr = strcasestr(txt_fname, ".svg"); extptr = strcasestr(txt_fname, ".svg");
#endif #endif
printf("### txt_fname = %s\n", txt_fname);
printf("### extptr = %s\n", extptr);
/*
### txt_fname = /usr/local/share/tuxpaint/stamps/animals/amphibians//frog-1.png
### extptr = .png
'/usr/local/share/tuxpaint/stamps/animals/amphibians//frog-1.png' has no locale-specific translation, using English: '01<30><31>7'
*/
if (extptr != NULL) if (extptr != NULL)
{ {
found = 0; found = 0;
@ -11005,33 +10996,20 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
for (i = 0; i < num_wished_langs && !found; i++) for (i = 0; i < num_wished_langs && !found; i++)
{ {
strcpy((char *)extptr, ".txt"); /* safe; pointing into a safe spot within an existing string (txt_fname) */ strcpy((char *)extptr, ".txt"); /* safe; pointing into a safe spot within an existing string (txt_fname) */
fprintf(stderr, "### txt_fname now '%s'\n", txt_fname);
fi = fopen(txt_fname, "r"); fi = fopen(txt_fname, "r");
fprintf(stderr, "\nReading: %s\n", txt_fname);
if (!fi) if (!fi)
return NULL; return NULL;
got_first = 0; got_first = 0;
// found = 0;
strcpy(def_buf, ""); strcpy(def_buf, "");
do do
{ {
fprintf(stderr, "### reading...\n");
if (fgets(buf, sizeof(buf), fi)) if (fgets(buf, sizeof(buf), fi))
{ {
if (!feof(fi)) if (!feof(fi))
{ {
fprintf(stderr, "### READ '%s'\n", buf);
strip_trailing_whitespace(buf); strip_trailing_whitespace(buf);
fprintf(stderr, "### TRIMMED '%s'\n", buf);
if (!got_first) if (!got_first)
{ {
@ -11039,7 +11017,6 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
strcpy(def_buf, buf); /* safe; both the same size */ strcpy(def_buf, buf); /* safe; both the same size */
got_first = 1; got_first = 1;
fprintf(stderr, "### THAT WAS FIRST, using as default!\n");
} }
debug(buf); debug(buf);
@ -11078,6 +11055,7 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
fclose(fi); fclose(fi);
} }
free(txt_fname); free(txt_fname);
@ -11086,14 +11064,11 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
if (found) if (found)
{ {
*locale_text = 1; *locale_text = 1;
fprintf(stderr, "'%s' has a locale-specific translation, using it: '%s'\n", fname, buf + strlen(lang_prefix) + 6); /* FIXME Remove */
return (strdup(buf + (strlen(lang_prefix)) + 6)); return (strdup(buf + (strlen(lang_prefix)) + 6));
} }
else else
{ {
/* No locale-specific translation; use the default (English) */ /* No locale-specific translation; use the default (English) */
fprintf(stderr, "'%s' has no locale-specific translation, using English: '%s'\n", fname, def_buf); /* FIXME Remove */
return (strdup(def_buf)); return (strdup(def_buf));
} }
} }
@ -11102,8 +11077,6 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
fprintf(stderr, "Somehow, '%s' doesn't have a filename extension!?\n", fname); fprintf(stderr, "Somehow, '%s' doesn't have a filename extension!?\n", fname);
return NULL; return NULL;
} }
printf("\n");
} }