From 75ee6d369109fb3ca3bf6777e8895291d49d6223 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 27 Aug 2023 22:56:07 +0200 Subject: [PATCH] test update language in config --- core/module/config/config.php | 18 +++++++++++++++++- core/module/install/install.php | 17 ----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/core/module/config/config.php b/core/module/config/config.php index d69fbd2e..a72a578e 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -588,6 +588,22 @@ class config extends common self::$updateButtonText = helper::translate('Mettre à jour'); } + /** + * Met à jour les dictionnaires des langues depuis les nouveaux modèles installés car ne fonctionne pas dans install update + */ + require_once('core/module/install/ressource/defaultdata.php'); + $installedLanguages = $this->getData(['language']); + $defaultLanguages = init::$defaultData['language']; + foreach ($installedLanguages as $key => $value) { + if ( + isset($defaultLanguages[$key]['version']) && + $defaultLanguages[$key]['version'] > $value['version'] + ) { + copy('core/module/install/ressource/i18n/' . $key . '.json', self::I18N_DIR . $key . '.json'); + $this->setData(['language', $key, $defaultLanguages[$key]]); + } + } + // Sélecteur de délais, compléter avec la traduction en jours foreach (self::$updateDelay as $key => $value) { self::$updateDelay[$key] = $key === 86400 ? $value . ' ' . helper::translate('jour') : $value . ' ' . helper::translate('jours'); @@ -616,7 +632,7 @@ class config extends common $typeMime = 'png'; break; default: - $typeMime = image_type_to_mime_type($typeMime); + $typeMime = image_type_to_mime_type($typeMime); } self::$imageOpenGraph['type'] = $typeMime; $imageSize = getimagesize($imagePath); diff --git a/core/module/install/install.php b/core/module/install/install.php index 1f4dcdee..2ba5e5bb 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -419,23 +419,6 @@ class install extends common } } - /** - * Met à jour les dictionnaires des langues depuis les nouveaux modèles installés - */ - require_once('core/module/install/ressource/defaultdata.php'); - $installedLanguages = $this->getData(['language']); - $defaultLanguages = init::$defaultData['language']; - foreach ($installedLanguages as $key => $value) { - if ( - isset($defaultLanguages[$key]['version']) && - $defaultLanguages[$key]['version'] > $value['version'] - ) { - copy('core/module/install/ressource/i18n/' . $key . '.json', self::I18N_DIR . $key . '.json'); - $this->setData(['language', $key, $defaultLanguages[$key]]); - } - } - die(); - // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_JSON,