Installation langue de l'UI WIP

This commit is contained in:
Fred Tempez 2022-09-21 10:19:55 +02:00
parent 9a6d4f6911
commit b8424ed6bd
2 changed files with 152 additions and 87 deletions

View File

@ -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

View File

@ -2,102 +2,110 @@
<?php echo template::topic('Renseignez les champs ci-dessous pour finaliser l\'installation.'); ?>
</p>
<?php echo template::formOpen('installForm'); ?>
<ul class="accordion" data-speed="150">
<li class="accordion-item active">
<h3 class="accordion-title">
<?php echo template::topic('Compte administrateur'); ?>
</h3>
<div class="accordion-content">
<div class="row">
<div class="col12">
<?php echo template::text('installId', [
'autocomplete' => 'off',
'label' => 'Identifiant'
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::password('installPassword', [
'autocomplete' => 'off',
'label' => 'Mot de passe'
]); ?>
</div>
<div class="col6">
<?php echo template::password('installConfirmPassword', [
'autocomplete' => 'off',
'label' => 'Confirmation'
]); ?>
</div>
</div>
<?php echo template::mail('installMail', [
'autocomplete' => 'off',
'label' => 'Adresse mail'
]); ?>
<div class="row">
<div class="col6">
<?php echo template::text('installFirstname', [
'autocomplete' => 'off',
'label' => 'Prénom'
]); ?>
</div>
<div class="col6">
<?php echo template::text('installLastname', [
'autocomplete' => 'off',
'label' => 'Nom'
]); ?>
</div>
</div>
<div class="installStep1">
<div class="row">
<div class="col12">
</div>
</li>
<li class="accordion-item">
<h3 class="accordion-title">
<?php echo template::topic('Options avancées'); ?>
</h3>
<div class="accordion-content">
<div class="row">
<div class="col12">
<?php echo template::checkbox('installDefaultData',true , 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
'checked' => false
]);
?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::select('installProxyType', $module::$proxyType, [
'label' => 'Type de proxy',
'selected' => $this->getData(['config', 'proxyType'])
</div>
</div>
<div class="installStep2">
<ul class="accordion" data-speed="150">
<li class="accordion-item active">
<h3 class="accordion-title">
<?php echo template::topic('Compte administrateur'); ?>
</h3>
<div class="accordion-content">
<div class="row">
<div class="col12">
<?php echo template::text('installId', [
'autocomplete' => 'off',
'label' => 'Identifiant'
]); ?>
</div>
<div class="col6">
<?php echo template::text('installProxyUrl', [
'label' => 'Adresse du proxy',
'placeholder' => 'cache.proxy.fr'
]); ?>
</div>
<div class="col3">
<?php echo template::text('installProxyPort', [
'label' => 'Port du proxy',
'placeholder' => '6060'
]); ?>
<div class="row">
<div class="col6">
<?php echo template::password('installPassword', [
'autocomplete' => 'off',
'label' => 'Mot de passe'
]); ?>
</div>
<div class="col6">
<?php echo template::password('installConfirmPassword', [
'autocomplete' => 'off',
'label' => 'Confirmation'
]); ?>
</div>
</div>
<?php echo template::mail('installMail', [
'autocomplete' => 'off',
'label' => 'Adresse mail'
]); ?>
<div class="row">
<div class="col6">
<?php echo template::text('installFirstname', [
'autocomplete' => 'off',
'label' => 'Prénom'
]); ?>
</div>
<div class="col6">
<?php echo template::text('installLastname', [
'autocomplete' => 'off',
'label' => 'Nom'
]); ?>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::select('installTheme', $module::$themes, [
'label' => 'Thème'
]); ?>
</li>
<li class="accordion-item">
<h3 class="accordion-title">
<?php echo template::topic('Options avancées'); ?>
</h3>
<div class="accordion-content">
<div class="row">
<div class="col12">
<?php echo template::checkbox('installDefaultData',true , 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
'checked' => false
]);
?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::select('installProxyType', $module::$proxyType, [
'label' => 'Type de proxy',
'selected' => $this->getData(['config', 'proxyType'])
]); ?>
</div>
<div class="col6">
<?php echo template::text('installProxyUrl', [
'label' => 'Adresse du proxy',
'placeholder' => 'cache.proxy.fr'
]); ?>
</div>
<div class="col3">
<?php echo template::text('installProxyPort', [
'label' => 'Port du proxy',
'placeholder' => '6060'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::select('installTheme', $module::$themes, [
'label' => 'Thème'
]); ?>
</div>
</div>
</div>
</li>
</ul>
<div class="row">
<div class="col3 offset9">
<?php echo template::submit('installSubmit', [
'value' => 'Installer'
]); ?>
</div>
</li>
</ul>
<div class="row">
<div class="col3 offset9">
<?php echo template::submit('installSubmit', [
'value' => 'Installer'
]); ?>
</div>
</div>
<?php echo template::formClose(); ?>