diff options
-rw-r--r-- | lib/i18n/i18n.h | 26 | ||||
-rw-r--r-- | po/POTFILES.in | 9 | ||||
-rw-r--r-- | ui/ncurses/Makefile.am | 1 | ||||
-rw-r--r-- | ui/ncurses/generic-main.c | 26 | ||||
-rw-r--r-- | ui/ncurses/nc-boot-editor.c | 26 | ||||
-rw-r--r-- | ui/ncurses/nc-config.c | 70 | ||||
-rw-r--r-- | ui/ncurses/nc-cui.c | 29 | ||||
-rw-r--r-- | ui/ncurses/nc-helpscreen.c | 5 | ||||
-rw-r--r-- | ui/ncurses/nc-menu.c | 3 | ||||
-rw-r--r-- | ui/ncurses/nc-sysinfo.c | 21 | ||||
-rw-r--r-- | ui/ncurses/nc-textscreen.c | 5 |
11 files changed, 140 insertions, 81 deletions
diff --git a/lib/i18n/i18n.h b/lib/i18n/i18n.h new file mode 100644 index 0000000..d7ff154 --- /dev/null +++ b/lib/i18n/i18n.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2013 IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef I18N_H +#define I18N_H + +#include <libintl.h> + +#define _(x) gettext(x) + +#endif /* I18N_H */ + diff --git a/po/POTFILES.in b/po/POTFILES.in index 667e27c..e9a8562 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1 +1,10 @@ # List of source files which contain translatable strings. + +ui/ncurses/nc-boot-editor.c +ui/ncurses/nc-config.c +ui/ncurses/nc-cui.c +ui/ncurses/nc-helpscreen.c +ui/ncurses/nc-menu.c +ui/ncurses/nc-sysinfo.c +ui/ncurses/nc-textscreen.c +ui/ncurses/generic-main.c diff --git a/ui/ncurses/Makefile.am b/ui/ncurses/Makefile.am index ded3193..be4c417 100644 --- a/ui/ncurses/Makefile.am +++ b/ui/ncurses/Makefile.am @@ -15,6 +15,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/lib \ + -DLOCALEDIR='"$(localedir)"' \ $(DEFAULT_CPPFLAGS) AM_CFLAGS = \ diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c index fe288ee..abf3356 100644 --- a/ui/ncurses/generic-main.c +++ b/ui/ncurses/generic-main.c @@ -30,10 +30,13 @@ #include <string.h> #include <limits.h> #include <sys/time.h> +#include <libintl.h> +#include <locale.h> #include "log/log.h" #include "talloc/talloc.h" #include "waiter/waiter.h" +#include "i18n/i18n.h" #include "ui/common/discover-client.h" #include "nc-cui.h" @@ -48,8 +51,9 @@ static void print_usage(void) { print_version(); printf( -"Usage: petitboot-nc [-h, --help] [-l, --log log-file]\n" -" [-s, --start-daemon] [-v, --verbose] [-V, --version]\n"); +"%s: petitboot-nc [-h, --help] [-l, --log log-file]\n" +" [-s, --start-daemon] [-v, --verbose] [-V, --version]\n", + _("Usage")); } /** @@ -198,26 +202,26 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui) "Petitboot (" PACKAGE_VERSION ")"); m->scr.frame.rtitle = NULL; m->scr.frame.help = talloc_strdup(m, - "Enter=accept, e=edit, n=new, x=exit, h=help"); - m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot"); + _("Enter=accept, e=edit, n=new, x=exit, h=help")); + m->scr.frame.status = talloc_strdup(m, _("Welcome to Petitboot")); i = pmenu_item_create(m, " "); item_opts_off(i->nci, O_SELECTABLE); pmenu_item_insert(m, i, 0); - i = pmenu_item_create(m, "System information"); + i = pmenu_item_create(m, _("System information")); i->on_execute = pmenu_sysinfo; pmenu_item_insert(m, i, 1); - i = pmenu_item_create(m, "System configuration"); + i = pmenu_item_create(m, _("System configuration")); i->on_execute = pmenu_config; pmenu_item_insert(m, i, 2); - i = pmenu_item_create(m, "Rescan devices"); + i = pmenu_item_create(m, _("Rescan devices")); i->on_execute = pmenu_reinit; pmenu_item_insert(m, i, 3); - i = pmenu_item_create(m, "Exit to shell"); + i = pmenu_item_create(m, _("Exit to shell")); i->on_execute = pmenu_exit_cb; pmenu_item_insert(m, i, 4); @@ -229,7 +233,7 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui) goto fail_setup; } - m->help_title = "main menu"; + m->help_title = _("main menu"); m->help_text = main_menu_help_text; menu_opts_off(m->ncm, O_SHOWDESC); @@ -281,6 +285,10 @@ int main(int argc, char *argv[]) result = opts_parse(&opts, argc, argv); + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + if (result) { print_usage(); return EXIT_FAILURE; diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c index 329699a..6bc1d89 100644 --- a/ui/ncurses/nc-boot-editor.c +++ b/ui/ncurses/nc-boot-editor.c @@ -25,6 +25,7 @@ #include "log/log.h" #include "talloc/talloc.h" +#include "i18n/i18n.h" #include "nc-boot-editor.h" #include "nc-widgets.h" @@ -220,7 +221,7 @@ static void boot_editor_process_key(struct nc_scr *scr, int key) break; case STATE_HELP: boot_editor->state = STATE_EDIT; - cui_show_help(boot_editor->cui, "Boot Option Editor", + cui_show_help(boot_editor->cui, _("Boot Option Editor"), boot_editor_help_text); break; default: @@ -365,7 +366,7 @@ static void boot_editor_populate_device_select(struct boot_editor *boot_editor, * changed. */ selected = !boot_editor->selected_device; - widget_select_add_option(select, -1, "Specify paths/URLs manually", + widget_select_add_option(select, -1, _("Specify paths/URLs manually"), selected); } @@ -445,7 +446,8 @@ static void boot_editor_setup_widgets(struct boot_editor *boot_editor, widgetset_set_widget_focus(boot_editor->widgetset, boot_editor_widget_focus, boot_editor); - boot_editor->widgets.device_l = widget_new_label(set, 0, 0, "Device:"); + boot_editor->widgets.device_l = widget_new_label(set, 0, 0, + _("Device:")); boot_editor->widgets.device_f = widget_new_select(set, 0, 0, field_size); widget_select_on_change(boot_editor->widgets.device_f, @@ -454,32 +456,32 @@ static void boot_editor_setup_widgets(struct boot_editor *boot_editor, boot_editor_populate_device_select(boot_editor, sysinfo); boot_editor->widgets.image_l = widget_new_label(set, 0, 0, - "Kernel:"); + _("Kernel:")); boot_editor->widgets.image_f = widget_new_textbox(set, 0, 0, field_size, boot_editor->image); boot_editor->widgets.initrd_l = widget_new_label(set, 0, 0, - "Initrd:"); + _("Initrd:")); boot_editor->widgets.initrd_f = widget_new_textbox(set, 0, 0, field_size, boot_editor->initrd); boot_editor->widgets.dtb_l = widget_new_label(set, 0, 0, - "Device tree:"); + _("Device tree:")); boot_editor->widgets.dtb_f = widget_new_textbox(set, 0, 0, field_size, boot_editor->dtb); boot_editor->widgets.args_l = widget_new_label(set, 0, 0, - "Boot arguments:"); + _("Boot arguments:")); boot_editor->widgets.args_f = widget_new_textbox(set, 0, 0, field_size, boot_editor->args); boot_editor->widgets.ok_b = widget_new_button(set, 0, 0, 6, - "OK", ok_click, boot_editor); + _("OK"), ok_click, boot_editor); boot_editor->widgets.help_b = widget_new_button(set, 0, 0, 6, - "Help", help_click, boot_editor); + _("Help"), help_click, boot_editor); boot_editor->widgets.cancel_b = widget_new_button(set, 0, 0, 6, - "Cancel", cancel_click, boot_editor); + _("Cancel"), cancel_click, boot_editor); } void boot_editor_update(struct boot_editor *boot_editor, @@ -535,10 +537,10 @@ struct boot_editor *boot_editor_init(struct cui *cui, boot_editor_post, boot_editor_unpost, boot_editor_resize); boot_editor->scr.frame.ltitle = talloc_strdup(boot_editor, - "Petitboot Option Editor"); + _("Petitboot Option Editor")); boot_editor->scr.frame.rtitle = NULL; boot_editor->scr.frame.help = talloc_strdup(boot_editor, - "tab=next, shift+tab=previous, x=exit, h=help"); + _("tab=next, shift+tab=previous, x=exit, h=help")); nc_scr_frame_draw(&boot_editor->scr); if (item) { diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index d345c85..54eb7ac 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -27,6 +27,7 @@ #include <talloc/talloc.h> #include <types/types.h> #include <log/log.h> +#include <i18n/i18n.h> #include "nc-cui.h" #include "nc-config.h" @@ -144,7 +145,7 @@ static void config_screen_process_key(struct nc_scr *scr, int key) } else if (screen->show_help) { screen->show_help = false; - cui_show_help(screen->cui, "System Configuration", + cui_show_help(screen->cui, _("System Configuration"), config_help_text); } else if (handled) { @@ -267,7 +268,7 @@ static int screen_process_form(struct config_screen *screen) if (!ip || !*ip || !mask || !*mask) { screen->scr.frame.status = - "No IP / mask values are set"; + _("No IP / mask values are set"); nc_scr_frame_draw(&screen->scr); talloc_free(config); return -1; @@ -530,9 +531,10 @@ static enum net_conf_type find_net_conf_type(const struct config *config) static void config_screen_setup_empty(struct config_screen *screen) { widget_new_label(screen->widgetset, 2, screen->field_x, - "Waiting for configuration data..."); + _("Waiting for configuration data...")); screen->widgets.cancel_b = widget_new_button(screen->widgetset, - 4, screen->field_x, 6, "Cancel", cancel_click, screen); + 4, screen->field_x, 6, _("Cancel"), + cancel_click, screen); } @@ -553,7 +555,8 @@ static void config_screen_setup_widgets(struct config_screen *screen, type = screen->net_conf_type; ifcfg = first_active_interface(config); - screen->widgets.autoboot_l = widget_new_label(set, 0, 0, "Autoboot:"); + screen->widgets.autoboot_l = widget_new_label(set, 0, 0, + _("Autoboot:")); screen->widgets.autoboot_f = widget_new_select(set, 0, 0, 55); widget_select_on_change(screen->widgets.autoboot_f, @@ -563,18 +566,19 @@ static void config_screen_setup_widgets(struct config_screen *screen, widget_select_add_option(screen->widgets.autoboot_f, AUTOBOOT_DISABLED, - "Don't autoboot", + _("Don't autoboot"), screen->autoboot_type == AUTOBOOT_DISABLED); widget_select_add_option(screen->widgets.autoboot_f, AUTOBOOT_ANY, - "Autoboot from any disk/network device", + _("Autoboot from any " + "disk/network device"), screen->autoboot_type == AUTOBOOT_ANY); widget_select_add_option(screen->widgets.autoboot_f, AUTOBOOT_ONE, - "Only autoboot from a specific " - "disk/network device", + _("Only autoboot from a specific " + "disk/network device"), screen->autoboot_type == AUTOBOOT_ONE); @@ -590,7 +594,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, if (selected) found = true; - label = talloc_asprintf(screen, "disk: %s [uuid: %s]", + label = talloc_asprintf(screen, _("disk: %s [uuid: %s]"), bd->name, bd->uuid); widget_select_add_option(screen->widgets.boot_device_f, i, @@ -608,7 +612,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, if (selected) found = true; - label = talloc_asprintf(screen, "net: %s [mac: %s]", + label = talloc_asprintf(screen, _("net: %s [mac: %s]"), info->name, mac); widget_select_add_option(screen->widgets.boot_device_f, @@ -619,7 +623,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, if (screen->autoboot_type == AUTOBOOT_ONE && !found) { char *label; - label = talloc_asprintf(screen, "Unknown UUID: %s", + label = talloc_asprintf(screen, _("Unknown UUID: %s"), config->boot_device); widget_select_add_option(screen->widgets.boot_device_f, -1, @@ -627,33 +631,34 @@ static void config_screen_setup_widgets(struct config_screen *screen, } str = talloc_asprintf(screen, "%d", config->autoboot_timeout_sec); - screen->widgets.timeout_l = widget_new_label(set, 0, 0, "Timeout:"); + screen->widgets.timeout_l = widget_new_label(set, 0, 0, _("Timeout:")); screen->widgets.timeout_f = widget_new_textbox(set, 0, 0, 5, str); - screen->widgets.timeout_help_l = widget_new_label(set, 0, 0, "seconds"); + screen->widgets.timeout_help_l = widget_new_label(set, 0, 0, + _("seconds")); widget_textbox_set_fixed_size(screen->widgets.timeout_f); widget_textbox_set_validator_integer(screen->widgets.timeout_f, 0, 999); - screen->widgets.network_l = widget_new_label(set, 0, 0, "Network:"); + screen->widgets.network_l = widget_new_label(set, 0, 0, _("Network:")); screen->widgets.network_f = widget_new_select(set, 0, 0, 50); widget_select_add_option(screen->widgets.network_f, NET_CONF_TYPE_DHCP_ALL, - "DHCP on all active interfaces", + _("DHCP on all active interfaces"), type == NET_CONF_TYPE_DHCP_ALL); widget_select_add_option(screen->widgets.network_f, NET_CONF_TYPE_DHCP_ONE, - "DHCP on a specific interface", + _("DHCP on a specific interface"), type == NET_CONF_TYPE_DHCP_ONE); widget_select_add_option(screen->widgets.network_f, NET_CONF_TYPE_STATIC, - "Static IP configuration", + _("Static IP configuration"), type == NET_CONF_TYPE_STATIC); widget_select_on_change(screen->widgets.network_f, config_screen_network_change, screen); - screen->widgets.iface_l = widget_new_label(set, 0, 0, "Device:"); + screen->widgets.iface_l = widget_new_label(set, 0, 0, _("Device:")); screen->widgets.iface_f = widget_new_select(set, 0, 0, 50); for (i = 0; i < sysinfo->n_interfaces; i++) { @@ -666,7 +671,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); snprintf(str, sizeof(str), "%s [%s, %s]", info->name, mac, - info->link ? "link up" : "link down"); + info->link ? _("link up") : _("link down")); widget_select_add_option(screen->widgets.iface_f, i, str, is_default); @@ -687,22 +692,22 @@ static void config_screen_setup_widgets(struct config_screen *screen, gw = ifcfg->static_config.gateway; } - screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, "IP/mask:"); + screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, _("IP/mask:")); screen->widgets.ip_addr_f = widget_new_textbox(set, 0, 0, 16, ip); screen->widgets.ip_mask_l = widget_new_label(set, 0, 0, "/"); screen->widgets.ip_mask_f = widget_new_textbox(set, 0, 0, 3, mask); screen->widgets.ip_addr_mask_help_l = - widget_new_label(set, 0, 0, "(eg. 192.168.0.10 / 24)"); + widget_new_label(set, 0, 0, _("(eg. 192.168.0.10 / 24)")); widget_textbox_set_fixed_size(screen->widgets.ip_addr_f); widget_textbox_set_fixed_size(screen->widgets.ip_mask_f); widget_textbox_set_validator_ipv4(screen->widgets.ip_addr_f); widget_textbox_set_validator_integer(screen->widgets.ip_mask_f, 1, 31); - screen->widgets.gateway_l = widget_new_label(set, 0, 0, "Gateway:"); + screen->widgets.gateway_l = widget_new_label(set, 0, 0, _("Gateway:")); screen->widgets.gateway_f = widget_new_textbox(set, 0, 0, 16, gw); screen->widgets.gateway_help_l = - widget_new_label(set, 0, 0, "(eg. 192.168.0.1)"); + widget_new_label(set, 0, 0, _("(eg. 192.168.0.1)")); widget_textbox_set_fixed_size(screen->widgets.gateway_f); widget_textbox_set_validator_ipv4(screen->widgets.gateway_f); @@ -714,21 +719,22 @@ static void config_screen_setup_widgets(struct config_screen *screen, config->network.dns_servers[i]); } - screen->widgets.dns_l = widget_new_label(set, 0, 0, "DNS Server(s):"); + screen->widgets.dns_l = widget_new_label(set, 0, 0, + _("DNS Server(s):")); screen->widgets.dns_f = widget_new_textbox(set, 0, 0, 32, str); screen->widgets.dns_help_l = - widget_new_label(set, 0, 0, "(eg. 192.168.0.2)"); + widget_new_label(set, 0, 0, _("(eg. 192.168.0.2)")); widget_textbox_set_validator_ipv4_multi(screen->widgets.dns_f); screen->widgets.dns_dhcp_help_l = widget_new_label(set, 0, 0, - "(if not provided by DHCP server)"); + _("(if not provided by DHCP server)")); - screen->widgets.ok_b = widget_new_button(set, 0, 0, 6, "OK", + screen->widgets.ok_b = widget_new_button(set, 0, 0, 6, _("OK"), ok_click, screen); - screen->widgets.help_b = widget_new_button(set, 0, 0, 6, "Help", + screen->widgets.help_b = widget_new_button(set, 0, 0, 6, _("Help"), help_click, screen); - screen->widgets.cancel_b = widget_new_button(set, 0, 0, 6, "Cancel", + screen->widgets.cancel_b = widget_new_button(set, 0, 0, 6, _("Cancel"), cancel_click, screen); } @@ -840,10 +846,10 @@ struct config_screen *config_screen_init(struct cui *cui, screen->field_x = 17; screen->scr.frame.ltitle = talloc_strdup(screen, - "Petitboot System Configuration"); + _("Petitboot System Configuration")); screen->scr.frame.rtitle = NULL; screen->scr.frame.help = talloc_strdup(screen, - "tab=next, shift+tab=previous, x=exit, h=help"); + _("tab=next, shift+tab=previous, x=exit, h=help")); nc_scr_frame_draw(&screen->scr); scrollok(screen->scr.sub_ncw, true); diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 6a61694..96d82ca 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -31,6 +31,7 @@ #include "talloc/talloc.h" #include "waiter/waiter.h" #include "process/process.h" +#include "i18n/i18n.h" #include "ui/common/discover-client.h" #include "ui/common/ui-system.h" #include "nc-cui.h" @@ -116,7 +117,7 @@ int cui_run_cmd(struct pmenu_item *item) struct cui *cui = cui_from_item(item); const char **cmd_argv = item->data; - nc_scr_status_printf(cui->current, "Running %s...", cmd_argv[0]); + nc_scr_status_printf(cui->current, _("Running %s..."), cmd_argv[0]); def_prog_mode(); @@ -127,7 +128,8 @@ int cui_run_cmd(struct pmenu_item *item) if (result) { pb_log("%s: failed: '%s'\n", __func__, cmd_argv[0]); - nc_scr_status_printf(cui->current, "Failed: %s", cmd_argv[0]); + nc_scr_status_printf(cui->current, _("Failed: %s"), + cmd_argv[0]); } return result; @@ -147,13 +149,13 @@ static int cui_boot(struct pmenu_item *item) pb_debug("%s: %s\n", __func__, cod->name); - nc_scr_status_printf(cui->current, "Booting %s...", cod->name); + nc_scr_status_printf(cui->current, _("Booting %s..."), cod->name); result = discover_client_boot(cui->client, NULL, cod->opt, cod->bd); if (result) { nc_scr_status_printf(cui->current, - "Failed: boot %s", cod->bd->image); + _("Failed: boot %s"), cod->bd->image); } return 0; @@ -180,7 +182,7 @@ static void cui_boot_editor_on_exit(struct cui *cui, int insert_pt; cod = talloc_zero(NULL, struct cui_opt_data); - cod->name = talloc_asprintf(cod, "User item %u", ++user_idx); + cod->name = talloc_asprintf(cod, _("User item %u"), ++user_idx); item = pmenu_item_create(menu, cod->name); if (!item) { @@ -572,7 +574,8 @@ static void cui_update_status(struct boot_status *status, void *arg) nc_scr_status_printf(cui->current, "%s: %s", - status->type == BOOT_STATUS_ERROR ? "Error" : "Info", + status->type == BOOT_STATUS_ERROR ? + _("Error") : _("Info"), status->message); } @@ -666,7 +669,7 @@ struct cui *cui_init(void* platform_info, if (!cui) { pb_log("%s: alloc cui failed.\n", __func__); - fprintf(stderr, "%s: alloc cui failed.\n", __func__); + fprintf(stderr, _("%s: alloc cui failed.\n"), __func__); goto fail_alloc; } @@ -699,19 +702,19 @@ retry_start: goto retry_start; pb_log("%s: discover_client_init failed.\n", __func__); - fprintf(stderr, "%s: error: discover_client_init failed.\n", + fprintf(stderr, _("%s: error: discover_client_init failed.\n"), __func__); - fprintf(stderr, "could not start pb-discover, the petitboot " - "daemon.\n"); + fprintf(stderr, _("could not start pb-discover, the petitboot " + "daemon.\n")); goto fail_client_init; } if (!cui->client) { pb_log("%s: discover_client_init failed.\n", __func__); - fprintf(stderr, "%s: error: discover_client_init failed.\n", + fprintf(stderr, _("%s: error: discover_client_init failed.\n"), __func__); - fprintf(stderr, "check that pb-discover, " - "the petitboot daemon is running.\n"); + fprintf(stderr, _("check that pb-discover, " + "the petitboot daemon is running.\n")); goto fail_client_init; } diff --git a/ui/ncurses/nc-helpscreen.c b/ui/ncurses/nc-helpscreen.c index d70a8ec..3b27d57 100644 --- a/ui/ncurses/nc-helpscreen.c +++ b/ui/ncurses/nc-helpscreen.c @@ -25,6 +25,7 @@ #include <types/types.h> #include <log/log.h> #include <util/util.h> +#include <i18n/i18n.h> #include "nc-cui.h" #include "nc-textscreen.h" @@ -56,10 +57,10 @@ struct help_screen *help_screen_init(struct cui *cui, screen = talloc_zero(cui, struct help_screen); screen->return_scr = current_scr; - title = "Petitboot help"; + title = _("Petitboot help"); if (title_suffix) title = talloc_asprintf(screen, - "Petitboot help: %s", title_suffix); + _("Petitboot help: %s"), title_suffix); text_screen_init(&screen->text_scr, cui, title, on_exit); text_screen_set_text(&screen->text_scr, text); diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c index a5794f7..531ea2d 100644 --- a/ui/ncurses/nc-menu.c +++ b/ui/ncurses/nc-menu.c @@ -29,6 +29,7 @@ #include "log/log.h" #include "talloc/talloc.h" +#include "i18n/i18n.h" #include "ui/common/ui-system.h" #include "nc-cui.h" #include "nc-menu.h" @@ -99,7 +100,7 @@ static const char *pmenu_item_label(struct pmenu_item *item, const char *name) /* if we have an invalid multibyte sequence, create an entirely * new name, indicating that we had invalid input */ if (len == SIZE_MAX) { - name = talloc_asprintf(item, "!Invalid option %d\n", + name = talloc_asprintf(item, _("!Invalid option %d"), ++invalid_idx); return name; } diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c index aa1daea..0d362e4 100644 --- a/ui/ncurses/nc-sysinfo.c +++ b/ui/ncurses/nc-sysinfo.c @@ -25,6 +25,7 @@ #include <types/types.h> #include <log/log.h> #include <util/util.h> +#include <i18n/i18n.h> #include "nc-cui.h" #include "nc-textscreen.h" @@ -56,24 +57,24 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen, #define line(...) text_screen_append_line(&screen->text_scr, __VA_ARGS__) if (!sysinfo) { - line("Waiting for system information..."); + line(_("Waiting for system information...")); return; } - line("%-12s %s", "System type:", sysinfo->type ?: ""); - line("%-12s %s", "System id:", sysinfo->identifier ?: ""); + line("%-12s %s", _("System type:"), sysinfo->type ?: ""); + line("%-12s %s", _("System id:"), sysinfo->identifier ?: ""); if (sysinfo->n_blockdevs) { line(NULL); - line("Storage devices"); + line(_("Storage devices")); } for (i = 0; i < sysinfo->n_blockdevs; i++) { struct blockdev_info *info = sysinfo->blockdevs[i]; line("%s:", info->name); - line(" UUID: %s", info->uuid); - line(" mounted at: %s", info->mountpoint); + line(_(" UUID: %s"), info->uuid); + line(_(" mounted at: %s"), info->mountpoint); line(NULL); } @@ -89,8 +90,8 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen, if_info_mac_str(info, macbuf, sizeof(macbuf)); line("%s:", info->name); - line(" MAC: %s", macbuf); - line(" link: %s", info->link ? "up" : "down"); + line(_(" MAC: %s"), macbuf); + line(_(" link: %s"), info->link ? "up" : "down"); line(NULL); } @@ -112,9 +113,9 @@ struct sysinfo_screen *sysinfo_screen_init(struct cui *cui, screen = talloc_zero(cui, struct sysinfo_screen); text_screen_init(&screen->text_scr, cui, - "Petitboot System Information", on_exit); + _("Petitboot System Information"), on_exit); text_screen_set_help(&screen->text_scr, - "System Information", sysinfo_help_text); + _("System Information"), sysinfo_help_text); sysinfo_screen_update(screen, sysinfo); diff --git a/ui/ncurses/nc-textscreen.c b/ui/ncurses/nc-textscreen.c index ad91f61..4ae0db4 100644 --- a/ui/ncurses/nc-textscreen.c +++ b/ui/ncurses/nc-textscreen.c @@ -26,6 +26,7 @@ #include <log/log.h> #include <fold/fold.h> #include <util/util.h> +#include <i18n/i18n.h> #include "nc-cui.h" #include "nc-textscreen.h" @@ -177,7 +178,7 @@ void text_screen_set_help(struct text_screen *screen, const char *title, { screen->help_title = title; screen->help_text = text; - screen->scr.frame.help = "x=exit, h=help"; + screen->scr.frame.help = _("x=exit, h=help"); } static int text_screen_post(struct nc_scr *scr) @@ -204,6 +205,6 @@ void text_screen_init(struct text_screen *screen, struct cui *cui, screen->scr.frame.ltitle = talloc_strdup(screen, title); screen->scr.frame.rtitle = NULL; - screen->scr.frame.help = "x=exit"; + screen->scr.frame.help = _("x=exit"); scrollok(screen->scr.sub_ncw, true); } |