translate devient i18n

This commit is contained in:
Fred Tempez 2021-06-04 13:41:21 +02:00
parent 579a3655df
commit 342df04879
4 changed files with 22 additions and 22 deletions

View File

@ -83,7 +83,7 @@ class init extends common {
],
'module' => [],
'user' => [],
'translate' => [
'i18n' => [
'scriptGoogle' => false,
'showCredits' => false,
'autoDetect' => false,

View File

@ -61,7 +61,7 @@ class translate extends common {
}
// Enregistrement des données
$this->setData(['config','translate', [
$this->setData(['config','i18n', [
'scriptGoogle' => $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN),
'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false,
'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN),

View File

@ -21,37 +21,37 @@
<b>Traduction automatique :</b>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagDE', true, 'Allemand', [
'checked' => $this->getData(['config','translate', 'scriptDE'])
'checked' => $this->getData(['config','i18n', 'scriptDE'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config','translate', 'scriptEN'])
'checked' => $this->getData(['config','i18n', 'scriptEN'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config','translate', 'scriptES'])
'checked' => $this->getData(['config','i18n', 'scriptES'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagIT', true, 'Italien', [
'checked' => $this->getData(['config','translate', 'scriptIT'])
'checked' => $this->getData(['config','i18n', 'scriptIT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config','translate', 'scriptNL'])
'checked' => $this->getData(['config','i18n', 'scriptNL'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config','translate', 'scriptPT'])
'checked' => $this->getData(['config','i18n', 'scriptPT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique', [
'checked' => $this->getData(['config','translate', 'autoDetect']),
'checked' => $this->getData(['config','i18n', 'autoDetect']),
'help' => 'Détecte la langue du navigateur.'
]); ?>
@ -61,32 +61,32 @@
<b>Traduction rédigée :</b>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config', 'translate', 'siteEN'])
'checked' => $this->getData(['config', 'i18n', 'siteEN'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagDE', true, 'Allemand', [
'checked' => $this->getData(['config', 'translate', 'siteDE'])
'checked' => $this->getData(['config', 'i18n', 'siteDE'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config', 'translate', 'siteES'])
'checked' => $this->getData(['config', 'i18n', 'siteES'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagIT', true, 'Italien', [
'checked' => $this->getData(['config', 'translate', 'siteIT'])
'checked' => $this->getData(['config', 'i18n', 'siteIT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config', 'translate', 'siteNL'])
'checked' => $this->getData(['config', 'i18n', 'siteNL'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config', 'translate', 'sitePT'])
'checked' => $this->getData(['config', 'i18n', 'sitePT'])
]); ?>
</div>
</div>
@ -101,18 +101,18 @@
<div class="row">
<div class="col4">
<?php echo template::checkbox('translateScriptGoogle', true, 'Active le script de traduction automatique', [
'checked' => $this->getData(['config','translate', 'scriptGoogle'])
'checked' => $this->getData(['config','i18n', 'scriptGoogle'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
'checked' => $this->getData(['config','translate', 'admin']),
'checked' => $this->getData(['config','i18n', 'admin']),
'help' => 'Traduction automatique du site et de l\'interface du CMS'
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
'checked' => $this->getData(['config','translate', 'showCredits']),
'checked' => $this->getData(['config','i18n', 'showCredits']),
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
]); ?>
</div>

View File

@ -199,20 +199,20 @@ class search extends common {
// Traduction du mot clé si le script Google Trad est actif
// Le multi langue est sélectionné
if ( $this->getData(['config','translate','scriptGoogle']) === true
if ( $this->getData(['config','i18n','scriptGoogle']) === true
AND
// et la traduction de la langue courante est automatique
( isset($_COOKIE['googtrans'])
AND ( $this->getData(['config','translate', substr($_COOKIE['googtrans'],4,2)]) === 'script'
AND ( $this->getData(['config','i18n', substr($_COOKIE['googtrans'],4,2)]) === 'script'
// Ou traduction automatique
OR $this->getData(['config','translate','autoDetect']) === true )
OR $this->getData(['config','i18n','autoDetect']) === true )
)
// Cas des pages d'administration
// Pas connecté
AND ( $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
// Ou connecté avec option active
OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getData(['config','translate','admin']) === true
AND $this->getData(['config','i18n','admin']) === true
)
)
AND !isset($_COOKIE['ZWII_I18N_SITE'])