summaryrefslogtreecommitdiffstats
path: root/src/serial-device
diff options
context:
space:
mode:
Diffstat (limited to 'src/serial-device')
-rw-r--r--src/serial-device/Makefile2
-rw-r--r--src/serial-device/main.vala17
-rw-r--r--src/serial-device/serial-device.vala20
3 files changed, 21 insertions, 18 deletions
diff --git a/src/serial-device/Makefile b/src/serial-device/Makefile
index d80279d..9c810ea 100644
--- a/src/serial-device/Makefile
+++ b/src/serial-device/Makefile
@@ -2,7 +2,7 @@ all: serial-device
@echo > /dev/null
serial-device: main.vala serial-device.vala ../input-device/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 serial-device
diff --git a/src/serial-device/main.vala b/src/serial-device/main.vala
index 5d5a107..95926b5 100644
--- a/src/serial-device/main.vala
+++ b/src/serial-device/main.vala
@@ -17,34 +17,37 @@
Device scanner;
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");
scanner = new Device(cfg.get_string("INPUT", "barcodescanner"), 9600, 8, 1);
} 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/devicescanner", scanner);
} catch(IOError e) {
- stderr.printf("Could not register service\n");
+ stderr.printf(_("Could not register service\n"));
}
}
diff --git a/src/serial-device/serial-device.vala b/src/serial-device/serial-device.vala
index ae7480b..3900128 100644
--- a/src/serial-device/serial-device.vala
+++ b/src/serial-device/serial-device.vala
@@ -36,11 +36,11 @@ public class Device {
if(lockfile.load_contents(null, out data, null)) {
pid = int.parse((string) data);
} else {
- error("Can't read lock file!\n");
+ error(_("Can't read lock file!\n"));
}
if(Posix.kill(pid, 0) == 0) {
- error("serial device is locked!\n");
+ error(_("serial device is locked!\n"));
}
}
@@ -52,11 +52,11 @@ public class Device {
if(fd < 0) {
fd = -1;
lockfile.delete();
- error("Could not open device!\n");
+ error(_("Could not open device!\n"));
}
} catch(Error e) {
- error("Could not create lock file: %s!\n", e.message);
+ error(_("Could not create lock file: %s!\n"), e.message);
}
@@ -160,12 +160,12 @@ public class Device {
io_read = new IOChannel.unix_new(fd);
io_read.set_line_term("\r\n", 2);
if(io_read.set_encoding(null) != IOStatus.NORMAL)
- error("Failed to set encoding");
+ error(_("Failed to set encoding"));
if(!(io_read.add_watch(IOCondition.IN | IOCondition.HUP, device_read) != 0)) {
- error("Could not bind IOChannel");
+ error(_("Could not bind IOChannel"));
}
} catch(IOChannelError e) {
- error("IOChannel: %s", e.message);
+ error(_("IOChannel: %s"), e.message);
}
}
@@ -186,7 +186,7 @@ public class Device {
size_t len, term_char;
if((cond & IOCondition.HUP) == IOCondition.HUP)
- error("Lost device");
+ error(_("Lost device"));
try {
ret = gio.read_line(out msg, out len, out term_char);
@@ -204,11 +204,11 @@ public class Device {
received_barcode(msg);
}
catch(IOChannelError e) {
- stderr.printf("IOChannel Error: %s", e.message);
+ stderr.printf(_("IOChannel Error: %s"), e.message);
return false;
}
catch(ConvertError e) {
- stderr.printf("Convert Error: %s", e.message);
+ stderr.printf(_("Convert Error: %s"), e.message);
return false;
}
return true;