luci-base: handle missing translations in template engine
Previously the template engine did not interpolate translation macros if no translation catalogue could be loaded due to a missing i18n directory. Change the offending code to return the original string in any error case. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
1380c7b07d
commit
9a81d8ff32
1 changed files with 4 additions and 14 deletions
|
@ -477,18 +477,8 @@ void luastr_translate(struct template_buffer *out, const char *s, unsigned int l
|
||||||
char *tr;
|
char *tr;
|
||||||
int trlen;
|
int trlen;
|
||||||
|
|
||||||
switch (lmo_translate(s, l, &tr, &trlen))
|
if (!lmo_translate(s, l, &tr, &trlen))
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
luastr_escape(out, tr, trlen, escape_xml);
|
luastr_escape(out, tr, trlen, escape_xml);
|
||||||
break;
|
else
|
||||||
|
|
||||||
case -1:
|
|
||||||
luastr_escape(out, s, l, escape_xml);
|
luastr_escape(out, s, l, escape_xml);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
/* no catalog loaded */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue