From ea64727f90a5f9a66c2fa81612e46ecdae438303 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Thu, 28 Jun 2018 21:35:23 +0200 Subject: all: I18N support 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, ""); --- src/scanner-session/main.vala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/scanner-session/main.vala') diff --git a/src/scanner-session/main.vala b/src/scanner-session/main.vala index 2ed94f9..3b876c5 100644 --- a/src/scanner-session/main.vala +++ b/src/scanner-session/main.vala @@ -16,13 +16,16 @@ ScannerSessionImplementation session; public static int main(string[] args) { + Intl.setlocale(LocaleCategory.ALL, ""); + Intl.textdomain("shopsystem"); + Bus.own_name( BusType.SYSTEM, "io.mainframe.shopsystem.ScannerSession", BusNameOwnerFlags.NONE, - on_bus_aquired, + on_bus_acquired, () => {}, - () => stderr.printf("Could not aquire name\n")); + () => stderr.printf(_("Could not acquire name\n"))); session = new ScannerSessionImplementation(); @@ -31,10 +34,10 @@ public static int main(string[] args) { return 0; } -void on_bus_aquired(DBusConnection con) { +void on_bus_acquired(DBusConnection con) { try { con.register_object("/io/mainframe/shopsystem/scanner_session", session); } catch(IOError e) { - stderr.printf("Could not register service\n"); + stderr.printf(_("Could not register service\n")); } } -- cgit v1.2.3