diff msitegen.inc.php @ 561:6b4cbd590d35

More locale initialization refactoring.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 24 Dec 2013 22:25:27 +0200
parents 279a98abe3d3
children d576bc58df3c
line wrap: on
line diff
--- a/msitegen.inc.php	Tue Dec 24 22:20:50 2013 +0200
+++ b/msitegen.inc.php	Tue Dec 24 22:25:27 2013 +0200
@@ -655,20 +655,6 @@
 
 
 
-function cmLocaleInit()
-{
-  global $pageCharset;
-
-  if (!isset($pageCharset))
-    $pageCharset = "UTF-8";
-
-  mb_internal_encoding($pageCharset);
-
-  $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
-  setlocale(LC_ALL, $tmp);
-}
-
-
 function cmPrintCSSLine($uri, $media = "")
 {
   echo
@@ -681,8 +667,6 @@
 {
   global $pageCSS, $pageCharset, $pageAuthor, $pageCSSData, $pageUrchin;
 
-  cmLocaleInit();
-
   echo
   "<!DOCTYPE html>\n".
   "<html>\n".
@@ -801,4 +785,19 @@
 }
 
 
+//
+// Global locale initialization
+//
+  if (!isset($localeInited) || !$localeInited)
+  {
+    $localeInited = TRUE;
+
+    if (!isset($pageCharset))
+      $pageCharset = "UTF-8";
+
+    mb_internal_encoding($pageCharset);
+
+    $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
+    setlocale(LC_ALL, $tmp);
+  }
 ?>
\ No newline at end of file