remove CRTAG_LOCLE define and lookups

This commit is contained in:
Enno Rehling 2017-03-14 08:27:15 +01:00
parent e68510a07e
commit 67a566d728

View file

@ -87,19 +87,23 @@ bool opt_cr_absolute_coords = false;
/* globals */ /* globals */
#define C_REPORT_VERSION 66 #define C_REPORT_VERSION 66
#define TAG_LOCALE "de" struct locale *crtag_locale(void) {
#ifdef TAG_LOCALE static struct locale * lang;
static int config;
if (config_changed(&config)) {
const char *lname = config_get("creport.tags");
lang = get_locale(lname ? lname : "de");
}
return lang;
}
static const char *crtag(const char *key) static const char *crtag(const char *key)
{ {
/* TODO: those locale lookups are shit, but static kills testing */ /* TODO: those locale lookups are shit, but static kills testing */
const char *result; const char *result;
const struct locale *lang = get_locale(TAG_LOCALE); result = LOC(crtag_locale(), key);
result = LOC(lang, key);
return result; return result;
} }
#else
#define crtag(x) (x)
#endif
/* /*
* translation table * translation table
*/ */
@ -134,7 +138,7 @@ static const char *translate(const char *key, const char *value)
return crtag(key); return crtag(key);
} }
static void write_translations(FILE * F) static void report_translations(FILE * F)
{ {
int i; int i;
fputs("TRANSLATION\n", F); fputs("TRANSLATION\n", F);
@ -1680,7 +1684,9 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
} }
} }
report_crtypes(F, f->locale); report_crtypes(F, f->locale);
write_translations(F); if (f->locale!=crtag_locale()) {
report_translations(F);
}
reset_translations(); reset_translations();
fclose(F); fclose(F);
return 0; return 0;