Browse Source

Permet de charger les traductions dans les thèmes

Il reste à copier les fichiers de traduction eux-mêmes.
Christophe HENRY 6 years ago
parent
commit
83d856ac61
3 changed files with 6 additions and 5 deletions
  1. 1 1
      common.php
  2. 2 2
      i18n.php
  3. 3 2
      install.php

+ 1 - 1
common.php

@@ -92,7 +92,7 @@ raintpl::configure("base_url", null );
 raintpl::configure("tpl_dir", './templates/'.$theme.'/' );
 raintpl::configure("cache_dir", "./cache/tmp/" );
 
-i18n_init($language);
+i18n_init($language, dirname(__FILE__).'/templates/'.$theme.'/');
 if ($resultUpdate) die (_t('LEED_UPDATE_MESSAGE'));
 
 $view = '';

+ 2 - 2
i18n.php

@@ -112,10 +112,10 @@ class Translation {
 }
 
 // Initialise le singleton, avec les langues possibles
-function i18n_init($languages){
+function i18n_init($languages, $location){
     global $i18n,$i18n_js;
     if (!isset($i18n)) {
-        $i18n = new Translation(dirname(__FILE__), $languages);
+        $i18n = new Translation($location, $languages);
         $i18n_js = $i18n->getJson();
     }
     return $i18n->language;

+ 3 - 2
install.php

@@ -19,10 +19,11 @@ $lang = '';
 if (isset($_GET['lang'])) $lang = $_GET['lang'];
 elseif (isset($_POST['install_changeLngLeed'])) $lang = $_POST['install_changeLngLeed'];
 
+$installDirectory = dirname(__FILE__).'/install';
 if (empty($lang))
-    $currentLanguage = i18n_init(Functions::getBrowserLanguages());
+    $currentLanguage = i18n_init(Functions::getBrowserLanguages(),$installDirectory);
 else
-    $currentLanguage = i18n_init($lang);
+    $currentLanguage = i18n_init($lang,$installDirectory);
 
 $languageList = $i18n->languages;