From: Jeremy Kerr Date: Mon, 28 Jul 2014 04:18:21 +0000 (+0800) Subject: discover: Use translated strings for boot status messages X-Git-Tag: v1.0.0~140 X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=a5dad9c05cd72820e64e0461889e9e77eaf8202d;ds=sidebyside discover: Use translated strings for boot status messages Since we're operating in the correct locale now, we can send translated strings in the boot status messages. Signed-off-by: Jeremy Kerr --- diff --git a/discover/boot.c b/discover/boot.c index ce9c1e0..6e7fda6 100644 --- a/discover/boot.c +++ b/discover/boot.c @@ -18,6 +18,7 @@ #include #include #include +#include #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); } diff --git a/discover/device-handler.c b/discover/device-handler.c index e7990e7..5a5210e 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -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); } diff --git a/po/POTFILES.in b/po/POTFILES.in index ee5d41f..ab96d5a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/po/en.po b/po/en.po index 94545bf..3355e99 100644 --- 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"