From 0caf5ba9fd3a3c0eff8c87cfe1ffa5f5479eb522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 20 Dec 2024 21:58:23 +0100 Subject: [PATCH] Edition de la traduction --- core/module/language/language.php | 38 ++++++++++++----------- core/module/language/view/index/index.php | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/core/module/language/language.php b/core/module/language/language.php index db0d482c..a665013e 100644 --- a/core/module/language/language.php +++ b/core/module/language/language.php @@ -257,15 +257,12 @@ class language extends common helper::dateUTF8('%d/%m/%Y', $value['date'], self::$i18nUI), //self::$i18nUI === $file ? helper::translate('Interface') : '', '', - /* - template::button('translateContentLanguageUIEdit' . $file, [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $file, - 'value' => template::ico('pencil'), - 'help' => 'Éditer', - 'disabled' => 'fr_FR' === $file - ]), - */ - + template::button('translateContentLanguageUIEdit' . $file, [ + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $file, + 'value' => template::ico('pencil'), + 'help' => 'Éditer', + 'disabled' => 'fr_FR' === $file + ]), template::button('translateContentLanguageUIDownload' . $file, [ 'class' => isset($storeUI[$file]['version']) && version_compare($installedUI[$file]['version'], $storeUI[$file]['version']) < 0 ? 'buttonGreen' : '', 'href' => helper::baseUrl() . $this->getUrl(0) . '/update/' . $file, @@ -511,7 +508,7 @@ class language extends common $data[$key] = $target; } } - $this->secure_file_put_contents(self::I18N_DIR . $lang . '.json', $data); + file_put_contents(self::I18N_DIR . $lang . '.json', json_encode($data)); // Mettre à jour le descripteur $this->setData([ @@ -539,13 +536,18 @@ class language extends common } // 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) { - if (!array_key_exists($key, $data)) { - $data[$key] = ''; - } - } - $this->secure_file_put_contents(self::I18N_DIR . $lang . '.json', $data); + /* + $dataFr = json_decode(file_get_contents(self::I18N_DIR . 'fr_FR.json'), true); + foreach ($dataFr as $key => $value) { + if (!array_key_exists($key, $data)) { + $data[$key] = ''; + } + } + file_put_contents(self::I18N_DIR . $lang . '.json', $data); + */ + + // Trier le tableau + asort($data); // Tableau des chaines à traduire dans la langue sélectionnée foreach ($data as $key => $value) { @@ -568,7 +570,7 @@ class language extends common 'title' => helper::translate('Éditer les dialogues') . ' ' . template::flag($lang, '20 %'), 'view' => 'edit', 'vendor' => [ - 'flatpickr', + 'tablednd' ], ]); } diff --git a/core/module/language/view/index/index.php b/core/module/language/view/index/index.php index 9d27d8fa..e79f9454 100644 --- a/core/module/language/view/index/index.php +++ b/core/module/language/view/index/index.php @@ -37,7 +37,7 @@ - +