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
public static $i18nUI = 'fr_FR';
public static $languagesUI = [
'ca' => 'Català, valencià',
'da' => 'Dansk',
'az_AZ' => 'Azərbaycan dili',
'bg_BG' => 'български език',
//'ca' => 'Català, valencià',
//'cs' => 'čeština, český jazyk',
//'da' => 'Dansk',
'de' => 'Deutsch',
'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',
'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
];
// Langues de contenu
// Sélection de langue de l'interface
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'
];
public static $i18nContent = 'fr_FR';
// Zone de temps
public static $timezone;
@ -303,7 +312,7 @@ class common {
setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) );
} else {
// 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
@ -334,7 +343,7 @@ class common {
self::$i18nUI = $this->getData(['config', 'i18n', 'interface']);
// La langue par défaut du contenu est celle du site si le cookie est absent.
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::$i18nUI . '.json')) {
@ -2186,7 +2195,7 @@ class common {
* Affiche le cadre avec les drapeaux sélectionnés
*/
public function showi18n() {
foreach (self::$languagesContent as $key => $value) {
foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config', 'i18n', $key]) === 'site'
) {
if (

View File

@ -853,6 +853,20 @@ if ($this->getData(['core', 'dataVersion']) < 11506) {
// Version 11.6.00
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
helper::deleteCookie('ZWII_USER_LONGTIME');

View File

@ -408,7 +408,7 @@ class plugin extends common {
public function index() {
// 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' ||
$key === 'fr') {
$i18nSites[$key] = $value;

View File

@ -24,7 +24,7 @@ class translate extends common {
// Language content
public static $translateOptions = [];
// Page pour la configuration dans la langue
// Page pour la configuration dans la langue
public static $pagesList = [];
public static $orphansList = [];
// Liste des langues installées
@ -34,7 +34,7 @@ class translate extends common {
// Activation du bouton de copie
public static $siteTranslate = true;
//UI
//UI
// Fichiers des langues de l'interface
public static $i18nFiles = [];
@ -65,7 +65,7 @@ class translate extends common {
// Enregistrer la langue
if ($success) {
$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 {
$notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions.";
}
@ -82,7 +82,7 @@ class translate extends common {
]);
}
// Tableau des langues installées
foreach (self::$languagesContent as $key => $value) {
foreach (self::$languagesUI as $key => $value) {
if ($this->getData(['config','i18n', $key]) === 'site') {
self::$languagesTarget[$key] = $value;
}
@ -105,7 +105,7 @@ class translate extends common {
// Soumission du formulaire
if($this->isPost()) {
// Edition des langues
foreach (self::$languagesContent as $keyi18n => $value) {
foreach (self::$languagesUI as $keyi18n => $value) {
if ($keyi18n === 'fr') continue;
// Effacement d'une langue installée
@ -198,7 +198,7 @@ class translate extends common {
'state' => true
]);
}
// Préparation de l'affichage du formulaire
// Liste des langues disponibles
@ -217,7 +217,7 @@ class translate extends common {
}
// 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') {
self::$translateOptions [$key] = [
'none' => 'Drapeau masqué',

View File

@ -60,7 +60,7 @@
</div>
</div>
</div>
<?php /** ?>
<div id="contentContainer" class="tabContent">
<div class="row">
<div class="col12">
@ -318,4 +318,5 @@
</div>
</div>
</div>
**/ ?>
<?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