changeset 76:f2e923f84e1b

Initialize locale.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 14 Sep 2016 18:14:31 +0300
parents 441d5338960e
children fcfd635d7abf
files mgallery.php
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mgallery.php	Wed Sep 14 17:33:55 2016 +0300
+++ b/mgallery.php	Wed Sep 14 18:14:31 2016 +0300
@@ -421,6 +421,21 @@
 
 
 //
+// Global locale initialization
+//
+if (!isset($localeInited) || !$localeInited)
+{
+  $localeInited = TRUE;
+  $pageCharset = "UTF-8";
+
+  mb_internal_encoding($pageCharset);
+
+  $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
+  setlocale(LC_ALL, $tmp);
+}
+
+
+//
 // Check language
 //
 if (($tmp = mgGetRequestItem("lang", FALSE, TRUE)) !== FALSE)