From 655eaf25ae253adfabdc69d531e3973d054d6042 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Wed, 25 Jan 2006 02:43:07 +0000 Subject: [project @ 2006-01-25 02:43:07 by rjw] Language configuration tool svn path=/import/netsurf/; revision=2038 --- riscos/gui.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'riscos/gui.c') diff --git a/riscos/gui.c b/riscos/gui.c index 86301099d..7a7be6515 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -487,18 +487,12 @@ void ro_gui_create_dirs(void) } /** - * Determine the language to use. - * - * RISC OS has no standard way of determining which language the user prefers. - * We have to guess from the 'Country' setting. + * Choose the language to use. */ void ro_gui_choose_language(void) { char path[40]; - const char *lang; - int country; - os_error *error; /* if option_language exists and is valid, use that */ if (option_language) { @@ -513,6 +507,25 @@ void ro_gui_choose_language(void) free(option_language); option_language = 0; } + + option_language = strdup(ro_gui_default_language()); + assert(option_language); + option_accept_language = strdup(option_language); + assert(option_accept_language); +} + + +/** + * Determine the default language to use. + * + * RISC OS has no standard way of determining which language the user prefers. + * We have to guess from the 'Country' setting. + */ +const char *ro_gui_default_language(void) { + char path[40]; + const char *lang; + int country; + os_error *error; /* choose a language from the configured country number */ error = xosbyte_read(osbyte_VAR_COUNTRY_NUMBER, &country); @@ -540,8 +553,8 @@ void ro_gui_choose_language(void) } sprintf(path, "NetSurf:Resources.%s", lang); if (is_dir(path)) - option_language = strdup(lang); - else + return lang; + return "en"; option_language = strdup("en"); assert(option_language); if (!option_accept_language) -- cgit v1.2.3