summaryrefslogtreecommitdiff
path: root/includes/helper/internationalization_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/helper/internationalization_helper.php')
-rw-r--r--includes/helper/internationalization_helper.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php
index ae88eb21..db150fec 100644
--- a/includes/helper/internationalization_helper.php
+++ b/includes/helper/internationalization_helper.php
@@ -17,14 +17,26 @@ function gettext_init() {
elseif (! isset($_SESSION['locale']))
$_SESSION['locale'] = $default_locale;
- putenv('LC_ALL=' . $_SESSION['locale']);
- setlocale(LC_ALL, $_SESSION['locale']);
+ gettext_locale();
bindtextdomain('default', '../locale');
bind_textdomain_codeset('default', 'UTF-8');
textdomain('default');
}
/**
+ * Swich gettext locale.
+ *
+ * @param string $locale
+ */
+function gettext_locale($locale = null) {
+ if ($locale == null)
+ $locale = $_SESSION['locale'];
+
+ putenv('LC_ALL=' . $locale);
+ setlocale(LC_ALL, $locale);
+}
+
+/**
* Renders language selection.
*
* @return string