From 75fc5a8233da8b7290bae2a2838fce965aa812e4 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 20 Sep 2022 11:35:55 +0200 Subject: [PATCH] File manager dans la langue de l'UI + variable default devient interface --- core/core.php | 8 ++++---- core/include/update.inc.php | 2 +- core/module/config/config.php | 2 +- core/module/install/ressource/defaultdata.php | 2 +- core/module/translate/translate.php | 2 +- core/module/translate/view/index/index.php | 4 ++-- core/vendor/filemanager/config/config.php | 11 +++++++---- site/i18n/es.json | 2 +- site/i18n/fr_FR.json | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/core/core.php b/core/core.php index 53d4e576..8f5c7465 100644 --- a/core/core.php +++ b/core/core.php @@ -306,7 +306,7 @@ class common { } // Langue de l'administration - self::$i18n = $this->getData(['config', 'i18n', 'default']); + self::$i18n = $this->getData(['config', 'i18n', 'interface']); // La langue par défaut du contenu est celle du site si le cookie est absent. self::$i18n = (empty(self::$i18n) || is_null(self::$i18n)) ? self::$i18n = 'fr' : self::$i18n ; @@ -1466,7 +1466,7 @@ class common { $this->getData(['user', $this->getUser('id') , 'files']) === true ) { $items .= '' . template::ico('folder', [ - 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json'), + 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') . '&lang=' . $this->getData(['config', 'i18n', 'interface']), 'margin' => 'all', 'attr' => 'data-lity', 'help' => 'Fichiers du site' @@ -1595,7 +1595,7 @@ class common { $this->getData(['user', $this->getUser('id') , 'files']) === true ) { $itemsRight .= '
  • ' . template::ico('folder', [ - 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json'), + 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') . '&lang=' . $this->getData(['config', 'i18n', 'interface']), 'attr' => 'data-lity', 'help' => 'Fichiers du site' ]). '
  • '; @@ -2021,7 +2021,7 @@ class common { // Items de droite $rightItems = ''; if($this->getUser('group') >= self::GROUP_MODERATOR) { - $rightItems .= '
  • ' . template::ico('folder') . '
  • '; + $rightItems .= '
  • ' . template::ico('folder') . '
  • '; } if($this->getUser('group') >= self::GROUP_ADMIN) { $rightItems .= '
  • ' . template::ico('brush', [ diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 54dc2f76..8e0aaf44 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -894,7 +894,7 @@ if ($this->getData(['core', 'dataVersion']) < 11600) { unlink('core/vendor/i18n/translation.js'); } // Langue de l'interface - $this->setData(['config', 'i18n', 'default', 'fr']); + $this->setData(['config', 'i18n', 'interface', 'fr']); // Mise à jour $this->setData(['core', 'dataVersion', 11600]); diff --git a/core/module/config/config.php b/core/module/config/config.php index 4a358c16..17d3783c 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -495,7 +495,7 @@ class config extends common { 'redirectLogin' => $this->getInput('connectRedirectLogin',helper::FILTER_BOOLEAN) ], 'i18n' => [ - 'default' => $this->getData(['config', 'i18n', 'default']), + 'interface' => $this->getData(['config', 'i18n', 'default']), 'fr' => $this->getData(['config', 'i18n', 'fr']), 'de' => $this->getData(['config', 'i18n', 'de']), 'en' => $this->getData(['config', 'i18n', 'en']), diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index d334ac4b..6a8e5614 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -42,7 +42,7 @@ class init extends common { 'redirectLogin' => true ], 'i18n' => [ - 'default' => 'fr', + 'interface' => 'fr', 'fr'=> 'none', 'de'=> 'none', 'en'=> 'none', diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 30f00b1b..ccd4ebcf 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -218,7 +218,7 @@ class translate extends common { ]); // Sauvegarder les langues de contenu $this->setData(['config', 'i18n', [ - 'default' => $this->getInput('translateI18n'), + 'interface' => $this->getInput('translateI18n'), 'fr' => $this->getInput('translateFR'), 'de' => $this->getInput('translateDE'), 'en' => $this->getInput('translateEN'), diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 921610fb..02a8cb4d 100644 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -46,13 +46,13 @@

    - +

    'Traductions installées', - 'selected' => $this->getData(['config', 'i18n' , 'default']), + 'selected' => $this->getData(['config', 'i18n' , 'interface']), ]); ?>
    diff --git a/core/vendor/filemanager/config/config.php b/core/vendor/filemanager/config/config.php index 8608494e..12530b5c 100644 --- a/core/vendor/filemanager/config/config.php +++ b/core/vendor/filemanager/config/config.php @@ -11,12 +11,15 @@ if (function_exists('mb_regex_encoding')) { } ob_start('mb_output_handler'); date_default_timezone_set('Europe/Paris'); -setlocale(LC_CTYPE, 'fr_FR'); //correct transliteration + +// Lire la langue installée +$tab = json_decode(file_get_contents('../../../site/data/config.json'), true); +$lang = $tab['config']['i18n']['interface']; +setlocale(LC_CTYPE, $lang); //correct transliteration /* Lecture du groupe de l'utilisateur connecté pour attribuer les droits et les dossiers */ $userId = $_COOKIE['ZWII_USER_ID']; -$json = file_get_contents('../../../site/data/user.json'); -$tab = json_decode($json, true); +$tab = json_decode(file_get_contents('../../../site/data/user.json'), true); $group = $tab['user'][$userId]['group']; $uploadDir = '/site/file/source/'; $currentPath = '../../../site/file/source/'; @@ -300,7 +303,7 @@ $config = array( | default language file name |-------------------------------------------------------------------------- */ - 'default_language' => "fr_FR", + 'default_language' => 'fr_FR', /* |-------------------------------------------------------------------------- diff --git a/site/i18n/es.json b/site/i18n/es.json index 9c33e9fe..14b2defd 100644 --- a/site/i18n/es.json +++ b/site/i18n/es.json @@ -328,7 +328,7 @@ "Interface": "", "Contenu du site": "", "Traductions installées": "", - "Interface de Zwii": "", + "Interface": "", "Paramétres": "", "Maintenance": "", "Scripts externes": "", diff --git a/site/i18n/fr_FR.json b/site/i18n/fr_FR.json index 3f10f640..a3296c84 100644 --- a/site/i18n/fr_FR.json +++ b/site/i18n/fr_FR.json @@ -328,7 +328,7 @@ "Interface": "", "Contenu du site": "", "Traductions installées": "", - "Interface de Zwii": "", + "Interface": "", "Paramétres": "", "Maintenance": "", "Scripts externes": "",