From c761c08d701521e79504be121f797cab6b027d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 14 Oct 2022 19:34:34 +0200 Subject: [PATCH] Translate bug $data pas ouvert --- core/core.php | 2 +- core/module/translate/translate.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/core.php b/core/core.php index 1c6483d9..83e9091a 100644 --- a/core/core.php +++ b/core/core.php @@ -49,7 +49,7 @@ class common // Numéro de version const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/'; - const ZWII_VERSION = '12.0.00-dev011'; + const ZWII_VERSION = '12.0.00-dev012'; const ZWII_UPDATE_CHANNEL = "test"; public static $actions = []; diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index ec224e54..a03d33ab 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -420,6 +420,11 @@ class translate extends common // Construction du formulaire + // Chargement des dialogue de la langue cible + if (!isset($data)) { + $data = json_decode(file_get_contents(self::I18N_DIR . $this->getUrl(2) . '.json'), true); + } + // Ajout des champs absents selon la langue de référence $dataFr = json_decode(file_get_contents(self::I18N_DIR . 'fr_FR.json'), true); foreach($dataFr as $key => $value) { @@ -430,9 +435,6 @@ class translate extends common file_put_contents (self::I18N_DIR . $this->getUrl(2) . '.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX); // Tableau des chaines à traduire dans la langue sélectionnée - if (!isset($data)) { - $data = json_decode(file_get_contents(self::I18N_DIR . $this->getUrl(2) . '.json'), true); - } foreach ($data as $key => $value) { self::$languagesUiInstalled[$key] = $value; }