forked from ZwiiCMS-Team/ZwiiCMS
12204
Delete useless makeUiLanguages Update UI languagues from template when install
This commit is contained in:
parent
0fcc2b511e
commit
a5b79b1689
@ -373,6 +373,25 @@ class install extends common
|
||||
// Effacer le backup
|
||||
unlink('.htaccess.bak');
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour les dictionnaires des langues depuis les modèles installés
|
||||
*/
|
||||
|
||||
// Langues installées
|
||||
$installedUI = $this->getData(['languages']);
|
||||
|
||||
// Langues disponibles avec la mise à jour
|
||||
$store = json_decode(file_get_contents('core\module\install\ressource\i18n\languages.json'), true);
|
||||
$store = $store['languages'];
|
||||
|
||||
foreach ($installedUI as $key => $value) {
|
||||
if ($store[$key]['version'] > $value['version']) {
|
||||
echo copy('core/module/install/ressource/i18n/' . $key . '.json', self::I18N_DIR . $key . '.json');
|
||||
$this->setData(['languages', $key, $store[$key]]);
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
@ -381,7 +400,6 @@ class install extends common
|
||||
'data' => null
|
||||
]
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,32 +418,4 @@ class install extends common
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Génère un fichier d'énumération des langues de l'UI
|
||||
*/
|
||||
private function makeUiLanguages()
|
||||
{
|
||||
// Générer une énumération absente
|
||||
if (empty($enums)) {
|
||||
if (is_dir(self::I18N_DIR) === false) {
|
||||
mkdir(self::I18N_DIR);
|
||||
}
|
||||
$dir = getcwd();
|
||||
chdir(self::I18N_DIR);
|
||||
$files = glob('*.json');
|
||||
chdir($dir);
|
||||
$enums = [];
|
||||
foreach ($files as $file => $value) {
|
||||
if (basename($value, '.json') === 'languages') {
|
||||
continue;
|
||||
}
|
||||
$enums[basename($value, '.json')] = [
|
||||
'version' => "?",
|
||||
'date' => 1672052400
|
||||
];
|
||||
}
|
||||
$this->setData(['languages', $enums]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user