summaryrefslogtreecommitdiffstats
path: root/src/input-device/input-device.vala
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-06-28 21:35:23 +0200
committerSebastian Reichel <sre@ring0.de>2018-06-28 23:15:27 +0200
commitea64727f90a5f9a66c2fa81612e46ecdae438303 (patch)
tree87d51301d0124e3a01fc434413b38a63ecdd31ef /src/input-device/input-device.vala
parentfb75ceb1c5a415cc6667043b1123e42586b1d9b1 (diff)
downloadserial-barcode-scanner-ea64727f90a5f9a66c2fa81612e46ecdae438303.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/input-device/input-device.vala')
-rw-r--r--src/input-device/input-device.vala12
1 files changed, 6 insertions, 6 deletions
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))