summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-21 19:10:21 -0200
committerRenato Botelho <renato@netgate.com>2016-01-21 19:12:10 -0200
commitceecd29b53b7d570b56fb391a09abb71fe80566b (patch)
treea764684df84eb4a876c9d8dda490cf37f18e1100 /src
parentb50d30c3a6d29b02cc7f4fe66f3a16bc7a4ea1a6 (diff)
downloadpfsense-ceecd29b53b7d570b56fb391a09abb71fe80566b.zip
pfsense-ceecd29b53b7d570b56fb391a09abb71fe80566b.tar.gz
Fix #5690:
- Remove parameters from set_language() - Add a global variable for default language - add env var for LANG, otherwise it won't work
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/config.inc9
-rw-r--r--src/etc/inc/globals.inc3
-rw-r--r--src/etc/inc/pfsense-utils.inc20
-rw-r--r--src/usr/local/www/system.php2
4 files changed, 19 insertions, 15 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() {
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index c0c5489..c791489 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -232,7 +232,7 @@ if ($_POST) {
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
- set_language($config['system']['language']);
+ set_language();
}
unset($config['system']['webgui']['webguileftcolumnhyper']);
OpenPOWER on IntegriCloud