forked from ZwiiCMS-Team/ZwiiCMS
Choix de la langue à l'installation
This commit is contained in:
parent
a62135c172
commit
c44a6c42df
@ -147,8 +147,54 @@ class common {
|
||||
self::GROUP_MODERATOR => 'Éditeur',
|
||||
self::GROUP_ADMIN => 'Administrateur'
|
||||
];
|
||||
// Langues proposées
|
||||
public static $i18nList = [
|
||||
|
||||
//Langues de l'UI
|
||||
// Langue de l'interface, tableau des dialogues
|
||||
public static $dialog;
|
||||
// Langue de l'interface sélectionnée
|
||||
public static $i18nUI = 'fr_FR';
|
||||
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
|
||||
];
|
||||
|
||||
// Langues de contenu
|
||||
public static $languagesContent = [
|
||||
'fr' => 'Français (fr)',
|
||||
'de' => 'Allemand (de)',
|
||||
'en' => 'Anglais (en)',
|
||||
@ -160,11 +206,6 @@ class common {
|
||||
// Sélection de langue de l'interface
|
||||
public static $i18nContent = 'fr';
|
||||
|
||||
// Langue de l'interface, tableau des dialogues
|
||||
public static $dialog;
|
||||
// Langue de l'interface sélectionnée
|
||||
public static $i18n = 'fr_FR';
|
||||
|
||||
// Zone de temps
|
||||
public static $timezone;
|
||||
private $url = '';
|
||||
@ -256,6 +297,8 @@ class common {
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur commun
|
||||
@ -270,16 +313,6 @@ class common {
|
||||
$this->input['_COOKIE'] = $_COOKIE;
|
||||
}
|
||||
|
||||
// Déterminer la langue du contenu du site
|
||||
if (isset($this->input['_COOKIE']['ZWII_I18N_SITE'])
|
||||
) {
|
||||
self::$i18nContent = $this->input['_COOKIE']['ZWII_I18N_SITE'];
|
||||
setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) );
|
||||
|
||||
} else {
|
||||
self::$i18nContent = 'fr';
|
||||
}
|
||||
|
||||
// Instanciation de la classe des entrées / sorties
|
||||
// Récupère les descripteurs
|
||||
foreach ($this->dataFiles as $keys => $value) {
|
||||
@ -306,15 +339,28 @@ class common {
|
||||
}
|
||||
|
||||
// Langue de l'administration
|
||||
self::$i18n = $this->getData(['config', 'i18n', 'interface']);
|
||||
self::$i18nUI = $this->getData(['config', 'i18n', 'interface']);
|
||||
// La langue par défaut du contenu est celle du site si le cookie est absent.
|
||||
self::$i18n = (empty(self::$i18n) || is_null(self::$i18n)) ? self::$i18n = 'fr' : self::$i18n ;
|
||||
self::$i18nUI = (empty(self::$i18nUI) || is_null(self::$i18nUI)) ? self::$i18nUI = 'fr_FR' : self::$i18nUI ;
|
||||
|
||||
|
||||
// Le fichier existe-t-il ?
|
||||
if (!file_exists(self::I18N_DIR . self::$i18n . '.json')) {
|
||||
self::$i18n = 'fr_FR';
|
||||
if (!file_exists(self::I18N_DIR . self::$i18nUI . '.json')) {
|
||||
self::$i18nUI = 'fr_FR';
|
||||
}
|
||||
|
||||
// Déterminer la langue du contenu du site
|
||||
if (isset($this->input['_COOKIE']['ZWII_I18N_SITE'])
|
||||
) {
|
||||
self::$i18nContent = $this->input['_COOKIE']['ZWII_I18N_SITE'];
|
||||
setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) );
|
||||
|
||||
} else {
|
||||
self::$i18nContent = substr(self::$i18nUI, 0, 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Utilisateur connecté
|
||||
if($this->user === []) {
|
||||
$this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]);
|
||||
@ -386,7 +432,7 @@ class common {
|
||||
}
|
||||
|
||||
// Chargement des dialogues
|
||||
self::$dialog = json_decode(file_get_contents(self::I18N_DIR . self::$i18n . '.json'), true);
|
||||
self::$dialog = json_decode(file_get_contents(self::I18N_DIR . self::$i18nUI . '.json'), true);
|
||||
|
||||
// Mise à jour des données core
|
||||
if( $this->getData(['core', 'dataVersion']) !== intval(str_replace('.','',self::ZWII_VERSION))) include( 'core/include/update.inc.php');
|
||||
@ -2160,7 +2206,7 @@ class common {
|
||||
* Affiche le cadre avec les drapeaux sélectionnés
|
||||
*/
|
||||
public function showi18n() {
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
foreach (self::$languagesContent as $key => $value) {
|
||||
if ($this->getData(['config', 'i18n', $key]) === 'site'
|
||||
) {
|
||||
if (
|
||||
|
@ -34,47 +34,9 @@ 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
|
||||
];
|
||||
// Fichiers des langues de l'interface
|
||||
public static $i18nFiles = [];
|
||||
|
||||
|
||||
/**
|
||||
* Pré-installation - choix de la langue
|
||||
|
18
core/module/install/view/index/update.css
Normal file
18
core/module/install/view/index/update.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
18
core/module/install/view/postinstall/update.css
Normal file
18
core/module/install/view/postinstall/update.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
@ -408,7 +408,7 @@ class plugin extends common {
|
||||
public function index() {
|
||||
|
||||
// Tableau des langues rédigées
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
foreach (self::$languagesContent as $key => $value) {
|
||||
if ($this->getData(['config','i18n', $key]) === 'site' ||
|
||||
$key === 'fr') {
|
||||
$i18nSites[$key] = $value;
|
||||
|
@ -37,46 +37,6 @@ class translate extends common {
|
||||
//UI
|
||||
// Fichiers des langues de l'interface
|
||||
public static $i18nFiles = [];
|
||||
// Langues de l'interface acceptées
|
||||
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
|
||||
];
|
||||
|
||||
/**
|
||||
* Configuration avancée des langues
|
||||
@ -105,7 +65,7 @@ class translate extends common {
|
||||
// Enregistrer la langue
|
||||
if ($success) {
|
||||
$this->setData(['config', 'i18n', $toCreate, 'site' ]);
|
||||
$notification = 'Données ' . self::$i18nList[$copyFrom] . ' copiées vers ' . self::$i18nList[$toCreate];
|
||||
$notification = 'Données ' . self::$languagesContent[$copyFrom] . ' copiées vers ' . self::$languagesContent[$toCreate];
|
||||
} else {
|
||||
$notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions.";
|
||||
}
|
||||
@ -122,7 +82,7 @@ class translate extends common {
|
||||
]);
|
||||
}
|
||||
// Tableau des langues installées
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
foreach (self::$languagesContent as $key => $value) {
|
||||
if ($this->getData(['config','i18n', $key]) === 'site') {
|
||||
self::$languagesTarget[$key] = $value;
|
||||
}
|
||||
@ -145,7 +105,7 @@ class translate extends common {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Edition des langues
|
||||
foreach (self::$i18nList as $keyi18n => $value) {
|
||||
foreach (self::$languagesContent as $keyi18n => $value) {
|
||||
if ($keyi18n === 'fr') continue;
|
||||
|
||||
// Effacement d'une langue installée
|
||||
@ -257,7 +217,7 @@ class translate extends common {
|
||||
}
|
||||
|
||||
// Modification des options de suppression de la langue installée.
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
foreach (self::$languagesContent as $key => $value) {
|
||||
if ($this->getData(['config','i18n',$key]) === 'site') {
|
||||
self::$translateOptions [$key] = [
|
||||
'none' => 'Drapeau masqué',
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="col12">
|
||||
<div class="block" id="flagsWrapper">
|
||||
<h4>
|
||||
<?php echo template::topic('Interface'); ?>
|
||||
<?php echo template::topic('Langue de l\'administration'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col4 offset4">
|
||||
|
@ -329,6 +329,9 @@
|
||||
"Contenu du site": "",
|
||||
"Traductions installées": "",
|
||||
"Interface": "",
|
||||
"Langue de l'administration": "",
|
||||
"Langues installées": "",
|
||||
"Dans quelle langue utiliserez-vous Zwii ?": "",
|
||||
"Paramétres": "",
|
||||
"Maintenance": "",
|
||||
"Scripts externes": "",
|
||||
|
@ -329,6 +329,9 @@
|
||||
"Contenu du site": "",
|
||||
"Traductions installées": "",
|
||||
"Interface": "",
|
||||
"Langue de l'administration": "",
|
||||
"Langues installées": "",
|
||||
"Dans quelle langue utiliserez-vous Zwii ?": "",
|
||||
"Paramétres": "",
|
||||
"Maintenance": "",
|
||||
"Scripts externes": "",
|
||||
|
Loading…
Reference in New Issue
Block a user