print more debug information when a name is missing.

This commit is contained in:
Enno Rehling 2018-02-17 21:14:47 +01:00
parent cb537b1a93
commit f9fcc01829

View file

@ -2113,13 +2113,15 @@ static void eval_resource(struct opstack **stack, const void *userdata)
const struct locale *lang = report ? report->locale : default_locale; const struct locale *lang = report ? report->locale : default_locale;
int j = opop(stack).i; int j = opop(stack).i;
const struct resource_type *res = (const struct resource_type *)opop(stack).v; const struct resource_type *res = (const struct resource_type *)opop(stack).v;
const char *c = LOC(lang, resourcename(res, j != 1)); const char *name = resourcename(res, j != 1);
const char *c = LOC(lang, name);
variant var; variant var;
if (c) { if (c) {
size_t len = strlen(c); size_t len = strlen(c);
var.v = strcpy(balloc(len + 1), c); var.v = strcpy(balloc(len + 1), c);
} else { } else {
log_error("missing translation for %s in eval_resource", name);
var.v = NULL; var.v = NULL;
} }
opush(stack, var); opush(stack, var);
@ -2131,11 +2133,17 @@ static void eval_race(struct opstack **stack, const void *userdata)
const struct locale *lang = report ? report->locale : default_locale; const struct locale *lang = report ? report->locale : default_locale;
int j = opop(stack).i; int j = opop(stack).i;
const race *r = (const race *)opop(stack).v; const race *r = (const race *)opop(stack).v;
const char *c = LOC(lang, rc_name_s(r, (j == 1) ? NAME_SINGULAR : NAME_PLURAL)); const char *name = rc_name_s(r, (j == 1) ? NAME_SINGULAR : NAME_PLURAL);
size_t len = strlen(c); const char *c = LOC(lang, name);
variant var; variant var;
if (c) {
var.v = strcpy(balloc(len + 1), c); size_t len = strlen(c);
var.v = strcpy(balloc(len + 1), c);
}
else {
log_error("missing translation for %s in eval_race", name);
var.v = NULL;
}
opush(stack, var); opush(stack, var);
} }