diff options
Diffstat (limited to 'src/etc/inc')
-rw-r--r-- | src/etc/inc/config.inc | 9 | ||||
-rw-r--r-- | src/etc/inc/globals.inc | 3 | ||||
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 20 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/etc/inc/config.inc b/src/etc/inc/config.inc index 800312e..1f64b9a 100644 --- a/src/etc/inc/config.inc +++ b/src/etc/inc/config.inc @@ -229,17 +229,10 @@ if (isset($config['system']['timezone']) && } date_default_timezone_set("$timezone"); -/* Set the default interface language */ -if ($config['system']['language'] <> "") { - $g['language'] = $config['system']['language']; -} elseif ($g['language'] == "") { - $g['language'] = 'en_US'; -} - if (!function_exists('set_language')) { require_once("pfsense-utils.inc"); } -set_language($g['language']); +set_language(); if ($config_parsed == true) { /* process packager manager custom rules */ diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index 946cfe6..c3e0b49 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -111,7 +111,8 @@ $g = array( "wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/", "help_base_url" => "/help.php", "pkg_prefix" => "pfSense-pkg-", - "default_timezone" => "Etc/UTC" + "default_timezone" => "Etc/UTC", + "language" => "en_US" ); /* IP TOS flags */ diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index ae00bee..5a0a34e 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -2756,11 +2756,21 @@ function pfSense_handle_custom_code($src_dir) { } } -function set_language($lang = 'en_US', $encoding = "UTF-8") { - setlocale(LC_ALL, "{$lang}.{$encoding}"); - textdomain("pfSense"); - bindtextdomain("pfSense", "/usr/local/share/locale"); - bind_textdomain_codeset("pfSense", "{$lang}.{$encoding}"); +function set_language() { + global $config, $g; + + if (!empty($config['system']['language'])) { + $lang = $config['system']['language']; + } elseif (!empty($g['language'])) { + $lang = $g['language']; + } + $lang .= ".UTF-8"; + + putenv("LANG={$lang}"); + $r = setlocale(LC_ALL, $lang); + $r = textdomain("pfSense"); + $r = bindtextdomain("pfSense", "/usr/local/share/locale"); + $r = bind_textdomain_codeset("pfSense", $lang); } function get_locale_list() { |