SUBDIRS = grub2
-AM_CPPFLAGS = -I$(top_srcdir)/lib $(DEFAULT_CPPFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/lib \
+ -DLOCALEDIR='"$(localedir)"' \
+ $(DEFAULT_CPPFLAGS)
AM_CFLAGS = $(DEFAULT_CFLAGS) \
-DPREFIX='"$(prefix)"' \
#include <system/system.h>
#include <process/process.h>
#include <url/url.h>
+#include <i18n/i18n.h>
#include "device-handler.h"
#include "discover-server.h"
static int device_handler_init_sources(struct device_handler *handler);
static void device_handler_reinit_sources(struct device_handler *handler);
+static void device_handler_update_lang(const char *lang);
+
void discover_context_add_boot_option(struct discover_context *ctx,
struct discover_boot_option *boot_option)
{
return;
discover_server_notify_config(handler->server, config);
+ device_handler_update_lang(config->lang);
device_handler_reinit(handler);
}
#ifndef PETITBOOT_TEST
+static void device_handler_update_lang(const char *lang)
+{
+ const char *cur_lang;
+
+ if (!lang)
+ return;
+
+ cur_lang = setlocale(LC_ALL, NULL);
+ if (cur_lang && !strcmp(cur_lang, lang))
+ return;
+
+ setlocale(LC_ALL, lang);
+}
+
static int device_handler_init_sources(struct device_handler *handler)
{
/* init our device sources: udev, network and user events */
#else
+static void device_handler_update_lang(const char *lang __attribute__((unused)))
+{
+}
+
static int device_handler_init_sources(
struct device_handler *handler __attribute__((unused)))
{
#include <log/log.h>
#include <process/process.h>
#include <talloc/talloc.h>
+#include <i18n/i18n.h>
#include "discover-server.h"
#include "device-handler.h"
struct opts opts;
FILE *log;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
if (opts_parse(&opts, argc, argv)) {
print_usage();
return EXIT_FAILURE;
if (opts.no_autoboot == opt_yes)
config_set_autoboot(false);
+ if (config_get()->lang)
+ setlocale(LC_ALL, config_get()->lang);
+
system_info_init(server);
handler = device_handler_init(server, waitset, opts.dry_run == opt_yes);