]> git.ozlabs.org Git - petitboot/commitdiff
discover: Use translated strings for boot status messages
authorJeremy Kerr <jk@ozlabs.org>
Mon, 28 Jul 2014 04:18:21 +0000 (12:18 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 28 Jul 2014 06:23:11 +0000 (14:23 +0800)
Since we're operating in the correct locale now, we can send translated
strings in the boot status messages.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/boot.c
discover/device-handler.c
po/POTFILES.in
po/en.po

index ce9c1e099f071d51245b8610e90db514fcb7a29b..6e7fda6559caaa873dd99520d5e1cd68398b89bb 100644 (file)
@@ -18,6 +18,7 @@
 #include <talloc/talloc.h>
 #include <url/url.h>
 #include <util/util.h>
+#include <i18n/i18n.h>
 
 #include "device-handler.h"
 #include "boot.h"
@@ -235,7 +236,7 @@ static void run_boot_hooks(struct boot_task *task)
                return;
 
        update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
-                       "running boot hooks");
+                       _("running boot hooks"));
 
        boot_hook_setenv(task);
 
@@ -298,7 +299,7 @@ static int check_load(struct boot_task *task, const char *name,
 
        update_status(task->status_fn, task->status_arg,
                        BOOT_STATUS_ERROR,
-                       "Couldn't load %s", name);
+                       _("Couldn't load %s"), name);
        return -1;
 }
 
@@ -381,12 +382,12 @@ static void boot_process(struct load_url_result *result, void *data)
        run_boot_hooks(task);
 
        update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
-                       "performing kexec_load");
+                       _("performing kexec_load"));
 
        rc = kexec_load(task);
        if (rc) {
                update_status(task->status_fn, task->status_arg,
-                               BOOT_STATUS_ERROR, "kexec load failed");
+                               BOOT_STATUS_ERROR, _("kexec load failed"));
        }
 
 no_load:
@@ -397,13 +398,13 @@ no_load:
        if (!rc) {
                update_status(task->status_fn, task->status_arg,
                                BOOT_STATUS_INFO,
-                               "performing kexec reboot");
+                               _("performing kexec reboot"));
 
                rc = kexec_reboot(task);
                if (rc) {
                        update_status(task->status_fn, task->status_arg,
                                        BOOT_STATUS_ERROR,
-                                       "kexec reboot failed");
+                                       _("kexec reboot failed"));
                }
        }
 }
@@ -418,7 +419,7 @@ static int start_url_load(struct boot_task *task, const char *name,
        if (!*result) {
                update_status(task->status_fn, task->status_arg,
                                BOOT_STATUS_ERROR,
-                               "Error loading %s", name);
+                               _("Error loading %s"), name);
                return -1;
        }
        return 0;
@@ -438,10 +439,10 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
        else if (cmd && cmd->boot_image_file)
                boot_desc = cmd->boot_image_file;
        else
-               boot_desc = "(unknown)";
+               boot_desc = _("(unknown)");
 
        update_status(status_fn, status_arg, BOOT_STATUS_INFO,
-                       "Booting %s.", boot_desc);
+                       _("Booting %s."), boot_desc);
 
        if (cmd && cmd->boot_image_file) {
                image = pb_url_parse(opt, cmd->boot_image_file);
@@ -450,7 +451,7 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
        } else {
                pb_log("%s: no image specified\n", __func__);
                update_status(status_fn, status_arg, BOOT_STATUS_INFO,
-                               "Boot failed: no image specified");
+                               _("Boot failed: no image specified"));
                return NULL;
        }
 
@@ -501,7 +502,7 @@ void boot_cancel(struct boot_task *task)
        task->cancelled = true;
 
        update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
-                       "Boot cancelled");
+                       _("Boot cancelled"));
 
        cleanup_cancellations(task, NULL);
 }
index e7990e7ab05f288331c8c09b54b9c3ef70b94319..5a5210e7956f6a5c707d12f13dff43b28220e756 100644 (file)
@@ -384,7 +384,7 @@ static void countdown_status(struct device_handler *handler,
        status.progress = -1;
        status.detail = NULL;
        status.message = talloc_asprintf(handler,
-                       "Booting in %d sec: %s", sec, opt->option->name);
+                       _("Booting in %d sec: %s"), sec, opt->option->name);
 
        discover_server_notify_boot_status(handler->server, &status);
 
@@ -812,7 +812,7 @@ void device_handler_cancel_default(struct device_handler *handler)
        status.type = BOOT_STATUS_INFO;
        status.progress = -1;
        status.detail = NULL;
-       status.message = "Default boot cancelled";
+       status.message = _("Default boot cancelled");
 
        discover_server_notify_boot_status(handler->server, &status);
 }
index ee5d41fbe5ff352f3085c2ed17c9a3394c607039..ab96d5af0a08521c5479fc5eb72e08b97422b96b 100644 (file)
@@ -1,5 +1,7 @@
 # List of source files which contain translatable strings.
 
+discover/boot.c
+discover/device-handler.c
 ui/ncurses/nc-boot-editor.c
 ui/ncurses/nc-config.c
 ui/ncurses/nc-cui.c
index 94545bfff06067c037a55c0386d446c25a17523a..3355e9978e49ca2ab4f2c46a9f150eb80d1f1f0e 100644 (file)
--- a/po/en.po
+++ b/po/en.po
@@ -16,6 +16,49 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
+msgid "running boot hooks"
+msgstr "running boot hooks"
+
+#, c-format
+msgid "Couldn't load %s"
+msgstr "Couldn't load %s"
+
+msgid "performing kexec_load"
+msgstr "performing kexec_load"
+
+msgid "kexec load failed"
+msgstr "kexec load failed"
+
+msgid "performing kexec reboot"
+msgstr "performing kexec reboot"
+
+msgid "kexec reboot failed"
+msgstr "kexec reboot failed"
+
+#, c-format
+msgid "Error loading %s"
+msgstr "Error loading %s"
+
+msgid "(unknown)"
+msgstr "(unknown)"
+
+#, c-format
+msgid "Booting %s."
+msgstr "Booting %s."
+
+msgid "Boot failed: no image specified"
+msgstr "Boot failed: no image specified"
+
+msgid "Boot cancelled"
+msgstr "Boot cancelled"
+
+#, c-format
+msgid "Booting in %d sec: %s"
+msgstr "Booting in %d sec: %s"
+
+msgid "Default boot cancelled"
+msgstr "Default boot cancelled"
+
 msgid "Boot Option Editor"
 msgstr "Boot Option Editor"