Edition de la traduction

This commit is contained in:
Fred Tempez 2024-12-20 21:58:23 +01:00
parent d19814f220
commit 0caf5ba9fd
2 changed files with 21 additions and 19 deletions

View File

@ -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') . '&nbsp;' . template::flag($lang, '20 %'),
'view' => 'edit',
'vendor' => [
'flatpickr',
'tablednd'
],
]);
}

View File

@ -37,7 +37,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>