From b8424ed6bd7d988dad423632e7619563267b3939 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 21 Sep 2022 10:19:55 +0200 Subject: [PATCH] Installation langue de l'UI WIP --- core/module/install/install.php | 57 +++++++ core/module/install/view/index/index.php | 182 ++++++++++++----------- 2 files changed, 152 insertions(+), 87 deletions(-) diff --git a/core/module/install/install.php b/core/module/install/install.php index 5c740c84..bb05ab5d 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -33,6 +33,48 @@ class install extends common { public static $newVersion; + // Fichiers des langues de l'interface + public static $i18nFiles = []; + public static $languagesUI = [ + 'az_AZ' => 'Azərbaycan dili', + 'bg_BG' => 'български език', + 'ca' => 'Català, valencià', + 'cs' => 'čeština, český jazyk', + 'da' => 'Dansk', + 'de' => 'Deutsch', + 'el_GR' => 'ελληνικά', + 'en_EN' => 'English', + 'es' => 'Español', + 'fa' => 'فارسی', + 'fr_FR' => 'Français', + 'he_IL' => 'Hebrew (Israel)', + 'hr' => 'Hrvatski jezik', + 'hu_HU' => 'Magyar', + 'id' => 'Bahasa Indonesia', + 'it' => 'Italiano', + 'ja' => '日本', + 'lt' => 'Lietuvių kalba', + 'mn_MN' => 'монгол', + 'nb_NO' => 'Norsk bokmål', + 'nn_NO' => 'Norsk nynorsk', + 'nl' => 'Nederlands, Vlaams', + 'pl' => 'Język polski, polszczyzna', + 'pt_BR' => 'Português(Brazil)', + 'pt_PT' => 'Português', + 'ro' => 'Română', + 'ru' => 'Pусский язык', + 'sk' => 'Slovenčina', + 'sl' => 'Slovenski jezik', + 'sv_SE' => 'Svenska', + 'th_TH' => 'ไทย', + 'tr_TR' => 'Türkçe', + 'uk_UA' => 'Yкраїнська мова', + 'vi' => 'Tiếng Việt', + 'zh_CN' => '中文 (Zhōngwén), 汉语, 漢語', + + // source: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + ]; + /** * Installation @@ -162,6 +204,21 @@ class install extends common { $dataThemes = json_decode($dataThemes, true); self::$themes = helper::arrayColumn($dataThemes, 'name'); + // Liste des langues UI disponibles + if (is_dir(self::I18N_DIR)) { + $dir = getcwd(); + chdir(self::I18N_DIR); + $files = glob('*.json'); + // Ajouter une clé au tableau avec le code de langue + foreach( $files as $file) { + // La langue est-elle référencée ? + if (array_key_exists(basename($file, '.json'), self::$languagesUI)) { + self::$i18nFiles[basename($file, '.json')] = self::$languagesUI[basename($file, '.json')]; + } + } + chdir($dir); + } + // Créer sitemap $this->createSitemap(); // Mise à jour de la liste des pages pour TinyMCE diff --git a/core/module/install/view/index/index.php b/core/module/install/view/index/index.php index bc0ac8db..f6614ad7 100644 --- a/core/module/install/view/index/index.php +++ b/core/module/install/view/index/index.php @@ -2,102 +2,110 @@

- -
-
- 'Installer' - ]); ?>
\ No newline at end of file