Edition de la traduction

This commit is contained in:
Fred Tempez 2024-12-20 21:58:25 +01:00
parent 73229b4726
commit be01fa9414
2 changed files with 15 additions and 10 deletions

View File

@ -500,7 +500,7 @@ class language extends common
$data[$key] = $target;
}
}
file_put_contents(self::I18N_DIR . $lang . '.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX);
file_put_contents(self::I18N_DIR . $lang . '.json', json_encode($data));
// Mettre à jour le descripteur
$this->setData([
@ -528,13 +528,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] = '';
}
}
file_put_contents(self::I18N_DIR . $lang . '.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX);
/*
$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) {
@ -557,7 +562,7 @@ class language extends common
'title' => helper::translate('Éditer les dialogues') . ' ' . template::flag($lang, '20 %'),
'view' => 'edit',
'vendor' => [
'tablednd',
'tablednd'
],
]);
}

View File

@ -24,7 +24,7 @@
<?php echo helper::translate('Langues installées'); ?>
</h4>
<?php if ($module::$languagesUiInstalled): ?>
<?php echo template::table([2, 1, 1, 5, 1, 1], $module::$languagesUiInstalled, ['Langues', 'Version', 'Date', '', '', '']); ?>
<?php echo template::table([2, 1, 1, 4, 1, 1, 1], $module::$languagesUiInstalled, ['Langues', 'Version', 'Date', '', '', '', '']); ?>
<?php endif; ?>
</div>
</div>