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/input-device/input-device.vala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/input-device/input-device.vala') diff --git a/src/input-device/input-device.vala b/src/input-device/input-device.vala index 1c558d0..1dba213 100644 --- a/src/input-device/input-device.vala +++ b/src/input-device/input-device.vala @@ -24,7 +24,7 @@ public class Device { public Device(string device) { if (device == "ignore") { - stdout.printf("Ignoring InputDevice!\n"); + stdout.printf(_("Ignoring InputDevice!\n")); return; } try { @@ -37,10 +37,10 @@ public class Device { Posix.fcntl(fd, Posix.F_SETFL, flags | Posix.O_NONBLOCK); if(!(io_read.add_watch(IOCondition.IN | IOCondition.HUP, device_read) != 0)) { - error("Could not bind IOChannel"); + error(_("Could not bind IOChannel")); } } catch(FileError e) { - error("FileError: %s", e.message); + error(_("File Error: %s"), e.message); } } @@ -212,7 +212,7 @@ public class Device { char key = '\0'; if((cond & IOCondition.HUP) == IOCondition.HUP) - error("Lost device"); + error(_("Lost device")); do { int fd = source.unix_get_fd(); @@ -221,7 +221,7 @@ public class Device { /* short read */ if (s != sizeof(Linux.Input.Event)) { if(s > 0) - stdout.printf("short read!\n"); + stdout.printf(_("short read!\n")); return true; } @@ -246,7 +246,7 @@ public class Device { buffer += "%c".printf(key); } while(key != '\n'); - stdout.printf("barcode: %s\n", buffer); + stdout.printf(_("barcode: %s\n"), buffer); if(buffer.has_prefix("USER ") || buffer.has_prefix("STOCK") || buffer.has_prefix("AMOUNT ")) { if(!check_code39_checksum(buffer)) -- cgit v1.2.3