diff options
Diffstat (limited to 'src/input-device')
-rw-r--r-- | src/input-device/Makefile | 2 | ||||
-rw-r--r-- | src/input-device/input-device.vala | 12 | ||||
-rw-r--r-- | src/input-device/main.vala | 19 |
3 files changed, 18 insertions, 15 deletions
diff --git a/src/input-device/Makefile b/src/input-device/Makefile index aba6c73..5e501df 100644 --- a/src/input-device/Makefile +++ b/src/input-device/Makefile @@ -2,7 +2,7 @@ all: input-device @echo > /dev/null input-device: main.vala input-device.vala input-device-interface.vala ../config/config-interface.vala - valac -X -w -o $@ --pkg linux --pkg posix --pkg gio-2.0 $^ + valac -X -D'GETTEXT_PACKAGE="shopsystem"' -X -w -o $@ --pkg linux --pkg posix --pkg gio-2.0 $^ clean: rm -rf input-device 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)) diff --git a/src/input-device/main.vala b/src/input-device/main.vala index 372418e..487c028 100644 --- a/src/input-device/main.vala +++ b/src/input-device/main.vala @@ -18,40 +18,43 @@ Device devScanner; Device devRfid; public static int main(string[] args) { + Intl.setlocale(LocaleCategory.ALL, ""); + Intl.textdomain("shopsystem"); + try { Config cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config"); devScanner = new Device(cfg.get_string("INPUT", "barcodescanner")); devRfid = new Device(cfg.get_string("INPUT", "rfidreader")); } catch(IOError e) { - error("IOError: %s\n", e.message); + error(_("IO Error: %s\n"), e.message); } catch(KeyFileError e) { - error("Config Error: %s\n", e.message); + error(_("Config Error: %s\n"), e.message); } catch(DBusError e) { - error("DBus Error: %s\n", e.message); + error(_("DBus Error: %s\n"), e.message); } Bus.own_name( BusType.SYSTEM, "io.mainframe.shopsystem.InputDevice", BusNameOwnerFlags.NONE, - on_bus_aquired, + on_bus_acquired, () => {}, - () => stderr.printf("Could not aquire name\n")); + () => stderr.printf(_("Could not acquire name\n"))); new MainLoop().run(); return 0; } -void on_bus_aquired(DBusConnection con) { +void on_bus_acquired(DBusConnection con) { try { con.register_object("/io/mainframe/shopsystem/device/scanner", devScanner); } catch(IOError e) { - stderr.printf("Could not register service\n"); + stderr.printf(_("Could not register service\n")); } try { con.register_object("/io/mainframe/shopsystem/device/rfid", devRfid); } catch(IOError e) { - stderr.printf("Could not register service\n"); + stderr.printf(_("Could not register service\n")); } } |