projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1380c7b
)
luci-base: handle missing translations in template engine
author
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 10 Jan 2015 20:19:54 +0000
(21:19 +0100)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 10 Jan 2015 20:19:54 +0000
(21:19 +0100)
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>
modules/luci-base/src/template_utils.c
patch
|
blob
|
history
diff --git
a/modules/luci-base/src/template_utils.c
b/modules/luci-base/src/template_utils.c
index 80542bd4f331d612c9071dfcbab8a58b14020f8e..6c4baa669c6ea225d0f80bb061e3e4b4585d5f10 100644
(file)
--- a/
modules/luci-base/src/template_utils.c
+++ b/
modules/luci-base/src/template_utils.c
@@
-477,18
+477,8
@@
void luastr_translate(struct template_buffer *out, const char *s, unsigned int l
char *tr;
int trlen;
- switch (lmo_translate(s, l, &tr, &trlen))
- {
- case 0:
- luastr_escape(out, tr, trlen, escape_xml);
- break;
-
- case -1:
- luastr_escape(out, s, l, escape_xml);
- break;
-
- default:
- /* no catalog loaded */
- break;
- }
+ if (!lmo_translate(s, l, &tr, &trlen))
+ luastr_escape(out, tr, trlen, escape_xml);
+ else
+ luastr_escape(out, s, l, escape_xml);
}