diff options
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/Makefile | 3 | ||||
-rw-r--r-- | src/cli/cli.vala | 11 | ||||
-rw-r--r-- | src/cli/main.vala | 26 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/cli/Makefile b/src/cli/Makefile index f042ca8..a66ce8f 100644 --- a/src/cli/Makefile +++ b/src/cli/Makefile @@ -2,8 +2,7 @@ all: cli @echo > /dev/null cli: main.vala cli.vala cli-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 cli diff --git a/src/cli/cli.vala b/src/cli/cli.vala index c0ba61e..0d0e9d4 100644 --- a/src/cli/cli.vala +++ b/src/cli/cli.vala @@ -15,14 +15,13 @@ [DBus (name = "io.mainframe.shopsystem.Cli")] public class CliImpl { - public signal void received_barcode(string barcode); public CliImpl() { - } + } - public void send(string msg) throws IOError, DBusError { - stdout.printf("Sending: %s\n", msg); - received_barcode(msg); - } + public void send(string msg) throws IOError, DBusError { + stdout.printf(_("Sending: %s\n"), msg); + received_barcode(msg); + } } diff --git a/src/cli/main.vala b/src/cli/main.vala index 377efa1..aacb3ba 100644 --- a/src/cli/main.vala +++ b/src/cli/main.vala @@ -18,20 +18,23 @@ MainLoop ml; string[] commands; public static int main(string[] args) { + Intl.setlocale(LocaleCategory.ALL, ""); + Intl.textdomain("shopsystem"); + if (args.length == 1) { - stdout.printf("Nothing to send.\nUsage: %s <commnds to send...>\nExample: %s \"USER 1\" \"LOGOUT\"\n", args[0], args[0]); + stdout.printf(_("Nothing to send.\nUsage: %s <commands to send...>\nExample: %s \"USER 1\" \"LOGOUT\"\n"), args[0], args[0]); return 0; } commands = args[1:args.length]; - + cli = new CliImpl(); Bus.own_name( BusType.SYSTEM, "io.mainframe.shopsystem.Cli", BusNameOwnerFlags.NONE, - on_bus_aquired, - on_name_aquired, - () => stderr.printf("Could not aquire name\n")); + on_bus_acquired, + on_name_acquired, + () => stderr.printf(_("Could not acquire name\n"))); ml = new MainLoop(); @@ -40,12 +43,12 @@ public static int main(string[] args) { return 0; } -void on_name_aquired() { +void on_name_acquired() { foreach (string cmd in commands) { try { cli.send(cmd); } catch (Error e) { - stderr.printf("Error sending command: %s", e.message); + stderr.printf(_("Error sending command: %s"), e.message); } } @@ -55,15 +58,14 @@ void on_name_aquired() { ml.quit (); return false; }); - time.attach (ml.get_context ()); - + time.attach (ml.get_context ()); } -void on_bus_aquired(DBusConnection con) { +void on_bus_acquired(DBusConnection con) { try { - con.register_object("/io/mainframe/shopsystem/cli", cli); + con.register_object("/io/mainframe/shopsystem/cli", cli); } catch(IOError e) { - stderr.printf("Could not register service\n"); + stderr.printf(_("Could not register service\n")); } } |