Module translate : neutralisation de la sélection de contenu

Un seul tableau de langues compatibles avec la normalisation
Conversion des noms de dossiers sur 2 caractères
This commit is contained in:
Fred Tempez 2022-09-24 17:27:15 +02:00
parent 88c12710fc
commit ce60948d8d
36 changed files with 53 additions and 29 deletions

View File

@ -154,37 +154,46 @@ class common {
// Langue de l'interface sélectionnée // Langue de l'interface sélectionnée
public static $i18nUI = 'fr_FR'; public static $i18nUI = 'fr_FR';
public static $languagesUI = [ public static $languagesUI = [
'ca' => 'Català, valencià', 'az_AZ' => 'Azərbaycan dili',
'da' => 'Dansk', 'bg_BG' => 'български език',
//'ca' => 'Català, valencià',
//'cs' => 'čeština, český jazyk',
//'da' => 'Dansk',
'de' => 'Deutsch', 'de' => 'Deutsch',
'en_EN' => 'English', 'en_EN' => 'English',
'es' => 'Español', 'es' => 'Español',
//'fa' => 'فارسی',
'fr_FR' => 'Français', 'fr_FR' => 'Français',
//'he_IL' => 'Hebrew (Israel)',
'hr' => 'Hrvatski jezik',
'hu_HU' => 'Magyar',
'id' => 'Bahasa Indonesia',
'it' => 'Italiano', 'it' => 'Italiano',
'ja' => '日本',
'lt' => 'Lietuvių kalba',
//'mn_MN' => 'монгол',
'nb_NO' => 'Norsk bokmål',
'nn_NO' => 'Norsk nynorsk',
'nl' => 'Nederlands, Vlaams', 'nl' => 'Nederlands, Vlaams',
'pl' => 'Język polski, polszczyzna', 'pl' => 'Język polski, polszczyzna',
'pt_BR' => 'Português(Brazil)',
'pt_PT' => 'Português', 'pt_PT' => 'Português',
'ro' => 'Română', 'ro' => 'Română',
'ru' => 'Pусский язык',
'sk' => 'Slovenčina',
'sl' => 'Slovenski jezik',
'sv_SE' => 'Svenska', 'sv_SE' => 'Svenska',
'tr_TR' => 'Türkçe' '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 // source: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
]; ];
// Langues de contenu // Langues de contenu
// Sélection de langue de l'interface public static $i18nContent = 'fr_FR';
public static $i18nContent = 'fr';
public static $languagesContent = [
'fr' => 'Français (fr)',
'de' => 'Deutsch (de)',
'en' => 'English (en)',
'es' => 'Español (es)',
'it' => 'Italiano (it)',
'nl' => 'Nederlands, Vlaams (nl)',
'pt' => 'Português (pt)',
'tr' => 'Türkçe'
];
// Zone de temps // Zone de temps
public static $timezone; public static $timezone;
@ -303,7 +312,7 @@ class common {
setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) ); setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) );
} else { } else {
// Absence du cookie, la langue par défaut est celle de l'interface. // Absence du cookie, la langue par défaut est celle de l'interface.
self::$i18nContent = (isset(self::$i18nUI)) ? substr(self::$i18nUI, 0, 2) : 'fr'; self::$i18nContent = (isset(self::$i18nUI)) ? self::$i18nUI : 'fr_FR';
} }
// Instanciation de la classe des entrées / sorties // Instanciation de la classe des entrées / sorties
@ -2186,7 +2195,7 @@ class common {
* Affiche le cadre avec les drapeaux sélectionnés * Affiche le cadre avec les drapeaux sélectionnés
*/ */
public function showi18n() { public function showi18n() {
foreach (self::$languagesContent as $key => $value) { foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config', 'i18n', $key]) === 'site' if ($this->getData(['config', 'i18n', $key]) === 'site'
) { ) {
if ( if (

View File

@ -853,6 +853,20 @@ if ($this->getData(['core', 'dataVersion']) < 11506) {
// Version 11.6.00 // Version 11.6.00
if ($this->getData(['core', 'dataVersion']) < 11600) { if ($this->getData(['core', 'dataVersion']) < 11600) {
// Correspondance pour les dossiers de langue à convertir
$languages = [
'fr' => 'fr_FR',
'en' => 'en_EN',
'pt' => 'pt_PT'
];
// COnvertit les dossiers vers la nouvelle structure
foreach($languages as $key => $value) {
if (is_dir(self::DATA_DIR . $key)) {
$this->copyDir(self::DATA_DIR . $key, self::DATA_DIR . $value);
$this->removeDir(self::DATA_DIR . $key);
}
}
// Supprime un cookie non nécessaire // Supprime un cookie non nécessaire
helper::deleteCookie('ZWII_USER_LONGTIME'); helper::deleteCookie('ZWII_USER_LONGTIME');

View File

@ -408,7 +408,7 @@ class plugin extends common {
public function index() { public function index() {
// Tableau des langues rédigées // Tableau des langues rédigées
foreach (self::$languagesContent as $key => $value) { foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config','i18n', $key]) === 'site' || if ($this->getData(['config','i18n', $key]) === 'site' ||
$key === 'fr') { $key === 'fr') {
$i18nSites[$key] = $value; $i18nSites[$key] = $value;

View File

@ -65,7 +65,7 @@ class translate extends common {
// Enregistrer la langue // Enregistrer la langue
if ($success) { if ($success) {
$this->setData(['config', 'i18n', $toCreate, 'site' ]); $this->setData(['config', 'i18n', $toCreate, 'site' ]);
$notification = 'Données ' . self::$languagesContent[$copyFrom] . ' copiées vers ' . self::$languagesContent[$toCreate]; $notification = 'Données ' . self::$languagesUI[$copyFrom] . ' copiées vers ' . self::$languagesUI[$toCreate];
} else { } else {
$notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions."; $notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions.";
} }
@ -82,7 +82,7 @@ class translate extends common {
]); ]);
} }
// Tableau des langues installées // Tableau des langues installées
foreach (self::$languagesContent as $key => $value) { foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config','i18n', $key]) === 'site') { if ($this->getData(['config','i18n', $key]) === 'site') {
self::$languagesTarget[$key] = $value; self::$languagesTarget[$key] = $value;
} }
@ -105,7 +105,7 @@ class translate extends common {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Edition des langues // Edition des langues
foreach (self::$languagesContent as $keyi18n => $value) { foreach (self::$languagesUI as $keyi18n => $value) {
if ($keyi18n === 'fr') continue; if ($keyi18n === 'fr') continue;
// Effacement d'une langue installée // Effacement d'une langue installée
@ -217,7 +217,7 @@ class translate extends common {
} }
// Modification des options de suppression de la langue installée. // Modification des options de suppression de la langue installée.
foreach (self::$languagesContent as $key => $value) { foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config','i18n',$key]) === 'site') { if ($this->getData(['config','i18n',$key]) === 'site') {
self::$translateOptions [$key] = [ self::$translateOptions [$key] = [
'none' => 'Drapeau masqué', 'none' => 'Drapeau masqué',

View File

@ -60,7 +60,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php /** ?>
<div id="contentContainer" class="tabContent"> <div id="contentContainer" class="tabContent">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
@ -318,4 +318,5 @@
</div> </div>
</div> </div>
</div> </div>
**/ ?>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>

BIN
core/vendor/i18n/png/az_AZ.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

BIN
core/vendor/i18n/png/bg_BG.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

BIN
core/vendor/i18n/png/fr_FR.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
core/vendor/i18n/png/he_IL.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

BIN
core/vendor/i18n/png/hr.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
core/vendor/i18n/png/hu_HU.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

BIN
core/vendor/i18n/png/id.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 109 B

BIN
core/vendor/i18n/png/ja.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

BIN
core/vendor/i18n/png/lt.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

BIN
core/vendor/i18n/png/nb_NO.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 99 B

BIN
core/vendor/i18n/png/nn_NO.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

BIN
core/vendor/i18n/png/pl.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

BIN
core/vendor/i18n/png/pt_BR.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

BIN
core/vendor/i18n/png/pt_PT.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

BIN
core/vendor/i18n/png/ro.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

BIN
core/vendor/i18n/png/ru.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

BIN
core/vendor/i18n/png/sk.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

BIN
core/vendor/i18n/png/sl.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

BIN
core/vendor/i18n/png/sv_SE.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
core/vendor/i18n/png/th_TH.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

BIN
core/vendor/i18n/png/tr_TR.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
core/vendor/i18n/png/uk_UA.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

BIN
core/vendor/i18n/png/vi.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
core/vendor/i18n/png/zh_CN.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B