diff options
author | Sebastian Reichel <sre@ring0.de> | 2018-06-28 21:35:23 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2018-06-28 23:15:27 +0200 |
commit | ea64727f90a5f9a66c2fa81612e46ecdae438303 (patch) | |
tree | 87d51301d0124e3a01fc434413b38a63ecdd31ef /src/web/template.vala | |
parent | fb75ceb1c5a415cc6667043b1123e42586b1d9b1 (diff) | |
download | serial-barcode-scanner-testing.tar.bz2 |
all: I18N supporttesting
This adds I18N support using standard gettext system together
with an initial German translation. This can be used to search
locales in some directory:
Intl.bindtextdomain("shopsystem", "/home/sre/src/serial-barcode-scanner");
And this can be used to switch language at runtime:
Intl.setlocale(LocaleCategory.ALL, "");
Diffstat (limited to 'src/web/template.vala')
-rw-r--r-- | src/web/template.vala | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/web/template.vala b/src/web/template.vala index b5265d8..f5c6d75 100644 --- a/src/web/template.vala +++ b/src/web/template.vala @@ -37,28 +37,28 @@ public class WebTemplate { uint8[] basis, menu, template, auth; if(!b.query_exists()) - throw new TemplateError.NOT_FOUND(templatedir+"base.html not found!"); + throw new TemplateError.NOT_FOUND(_("%s not found!").printf(templatedir+"base.html")); if(!m.query_exists()) - throw new TemplateError.NOT_FOUND(templatedir+"menu.html not found!"); + throw new TemplateError.NOT_FOUND(_("%s not found!").printf(templatedir+"menu.html")); if(!fauth.query_exists()) - throw new TemplateError.NOT_FOUND(fauth.get_path()+" not found!"); + throw new TemplateError.NOT_FOUND(_("%s not found!").printf(fauth.get_path())); if(!f.query_exists()) - throw new TemplateError.NOT_FOUND(templatedir+file+" not found!"); + throw new TemplateError.NOT_FOUND(_("%s not found!").printf(templatedir+file)); try { if(!b.load_contents(null, out basis, null)) - throw new TemplateError.NOT_LOADABLE(templatedir+"base.html could not be loaded!"); + throw new TemplateError.NOT_LOADABLE(_("%s could not be loaded!").printf(templatedir+"base.html")); if(!m.load_contents(null, out menu, null)) - throw new TemplateError.NOT_LOADABLE(templatedir+"menu.html could not be loaded!"); + throw new TemplateError.NOT_LOADABLE(_("%s could not be loaded!").printf(templatedir+"menu.html")); if(!fauth.load_contents(null, out auth, null)) - throw new TemplateError.NOT_LOADABLE(fauth.get_path()+" could not be loaded!"); + throw new TemplateError.NOT_LOADABLE(_("%s could not be loaded!").printf(fauth.get_path())); if(!f.load_contents(null, out template, null)) - throw new TemplateError.NOT_LOADABLE(templatedir+file+" could not be loaded!"); + throw new TemplateError.NOT_LOADABLE(_("%s could not be loaded!").printf(templatedir+file)); } catch(Error e) { - throw new TemplateError.NOT_LOADABLE("could not load templates!"); + throw new TemplateError.NOT_LOADABLE(_("could not load templates!")); } this.template = ((string) basis).replace("{{{NAVBAR}}}", ((string) menu)); @@ -75,13 +75,13 @@ public class WebTemplate { uint8[] template; if(!f.query_exists()) - throw new TemplateError.NOT_FOUND(templatedir+file+" not found!"); + throw new TemplateError.NOT_FOUND(_("%s not found!").printf(templatedir+file)); try { if(!f.load_contents(null, out template, null)) - throw new TemplateError.NOT_LOADABLE(templatedir+file+" could not be loaded!"); + throw new TemplateError.NOT_LOADABLE(_("%s could not be loaded!").printf(templatedir+file)); } catch(Error e) { - throw new TemplateError.NOT_LOADABLE("could not load templates!"); + throw new TemplateError.NOT_LOADABLE(_("could not load templates!")); } this.template = (string) template; |