Préparation traduction rédigée
This commit is contained in:
parent
07b7c5350f
commit
19039a8eb2
@ -228,7 +228,7 @@ class common {
|
||||
}
|
||||
|
||||
// Traduction du site avec le script Google
|
||||
if ( $this->getData(['config','translate','activated'])) {
|
||||
if ( $this->getData(['config','translate','scriptGoogle'])) {
|
||||
// Lire la langue stockée dans le cookie (choix manuel)
|
||||
if ( isset($_COOKIE['ZWII_USER_I18N']) ) {
|
||||
$lan_cookie = $_COOKIE['ZWII_USER_I18N'];
|
||||
@ -1567,7 +1567,7 @@ class common {
|
||||
$this->setData(['locale','searchPageId',$this->getData(['config','searchPageId'])]);
|
||||
$this->setData(['locale','metaDescription',$this->getData(['config','metaDescription'])]);
|
||||
$this->setData(['locale','title',$this->getData(['config','title'])]);
|
||||
$this->setData(['config','translate','activated',false]);
|
||||
$this->setData(['config','translate','scriptGoogle',false]);
|
||||
$this->setData(['config','translate','showCredits',false]);
|
||||
$this->setData(['config','translate','autoDetect',false]);
|
||||
$this->setData(['core', 'dataVersion', 10400]);
|
||||
@ -2157,7 +2157,7 @@ class core extends common {
|
||||
|
||||
// Chargement de la librairie ggogtrans
|
||||
// Le multi langue est actif
|
||||
if ($this->getData(['config','translate','activated']) === true ) {
|
||||
if ($this->getData(['config','translate','scriptGoogle']) === true ) {
|
||||
// la traduction auto est active
|
||||
if ( $this->getData(['config','translate','autoDetect']) === true
|
||||
// Cas des pages d'administration
|
||||
@ -2312,7 +2312,7 @@ class layout extends common {
|
||||
*/
|
||||
|
||||
if ( (
|
||||
( $this->getData(['config','translate','activated']) === true
|
||||
( $this->getData(['config','translate','scriptGoogle']) === true
|
||||
AND substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
|
||||
)
|
||||
OR ( isset($_COOKIES['ZWII_USER_I18N'])
|
||||
@ -3010,10 +3010,10 @@ class layout extends common {
|
||||
* Affiche le cadre avec les drapeaux
|
||||
*/
|
||||
public function showi18n() {
|
||||
if ( $this->getData(['config','translate','activated']) === true ) {
|
||||
if ( $this->getData(['config','translate','scriptGoogle']) === true ) {
|
||||
echo '<div id="i18nContainer"><ul>';
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
if ($this->getData(['config','translate','flag' . strtoupper($key)]) ) {
|
||||
if ($this->getData(['config','translate','script' . strtoupper($key)]) ) {
|
||||
echo '<li>';
|
||||
echo '<a href="' . helper::baseUrl() . 'translate/language/' . $key . '/' . $this->getUrl(0) . '"><img class= "flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png" /></a>';
|
||||
echo '</li>';
|
||||
|
@ -43,7 +43,7 @@ class init extends common {
|
||||
'captcha' => true
|
||||
],
|
||||
'translate' => [
|
||||
'activated' => false,
|
||||
'scriptGoogle' => false,
|
||||
'showCredits' => false,
|
||||
'autoDetect' => false,
|
||||
'admin' => false,
|
||||
|
@ -27,17 +27,25 @@ class translate extends common {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['config','translate', [
|
||||
'activated' => $this->getInput('translateActivated', helper::FILTER_BOOLEAN),
|
||||
'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),
|
||||
'admin' => $this->getInput('translateAdmin', helper::FILTER_BOOLEAN),
|
||||
'flagFR' => $this->getInput('translateFlagFR', helper::FILTER_BOOLEAN),
|
||||
'flagDE' => $this->getInput('translateFlagDE', helper::FILTER_BOOLEAN),
|
||||
'flagEN' => $this->getInput('translateFlagEN', helper::FILTER_BOOLEAN),
|
||||
'flagES' => $this->getInput('translateFlagES', helper::FILTER_BOOLEAN),
|
||||
'flagIT' => $this->getInput('translateFlagIT', helper::FILTER_BOOLEAN),
|
||||
'flagNL' => $this->getInput('translateFlagNL', helper::FILTER_BOOLEAN),
|
||||
'flagPT' => $this->getInput('translateFlagPT', helper::FILTER_BOOLEAN)
|
||||
'scriptFR' => $this->getInput('translateFlagScriptFR', helper::FILTER_BOOLEAN),
|
||||
'scriptDE' => $this->getInput('translateFlagScriptDE', helper::FILTER_BOOLEAN),
|
||||
'scriptEN' => $this->getInput('translateFlagScriptEN', helper::FILTER_BOOLEAN),
|
||||
'scriptES' => $this->getInput('translateFlagScriptES', helper::FILTER_BOOLEAN),
|
||||
'scriptIT' => $this->getInput('translateFlagScriptIT', helper::FILTER_BOOLEAN),
|
||||
'scriptNL' => $this->getInput('translateFlagScriptNL', helper::FILTER_BOOLEAN),
|
||||
'scriptPT' => $this->getInput('translateFlagScriptPT', helper::FILTER_BOOLEAN),
|
||||
'site' => $this->getInput('translateSite', helper::FILTER_BOOLEAN),
|
||||
'siteFR' => $this->getInput('translateFlagSiteFR', helper::FILTER_BOOLEAN),
|
||||
'siteDE' => $this->getInput('translateFlagSiteDE', helper::FILTER_BOOLEAN),
|
||||
'siteEN' => $this->getInput('translateFlagSiteEN', helper::FILTER_BOOLEAN),
|
||||
'siteES' => $this->getInput('translateFlagSiteES', helper::FILTER_BOOLEAN),
|
||||
'siteIT' => $this->getInput('translateFlagSiteIT', helper::FILTER_BOOLEAN),
|
||||
'siteNL' => $this->getInput('translateFlagSiteNL', helper::FILTER_BOOLEAN),
|
||||
'sitePT' => $this->getInput('translateFlagSitePT', helper::FILTER_BOOLEAN)
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
|
@ -15,77 +15,125 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres</h4>
|
||||
<h4>Traduction automatique (Google Translate)</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateActivated', true, 'Activer le mode multi-langues', [
|
||||
'checked' => $this->getData(['config','translate', 'activated'])
|
||||
<?php echo template::checkbox('translateScriptGoogle', true, 'Active le script de traduction automatique', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptGoogle'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique', [
|
||||
'checked' => $this->getData(['config','translate', 'autoDetect']),
|
||||
'help' => 'Détecte la langue du navigateur.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptFR', true, 'Français', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptFR'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptES'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagScriptPT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptPT'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
|
||||
'checked' => $this->getData(['config','translate', 'admin']),
|
||||
'help' => 'Traduction automatique du site et de l\'interface du CMS'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
|
||||
'checked' => $this->getData(['config','translate', 'showCredits']),
|
||||
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Traduction automatique</h4>
|
||||
<h4>Traduction rédigée</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique de langue', [
|
||||
'checked' => $this->getData(['config','translate', 'autoDetect']),
|
||||
'help' => 'Détecte la langue du navigateur et effectue une traduction grâce à Google Translate.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
|
||||
'checked' => $this->getData(['config','translate', 'admin']),
|
||||
'help' => 'Traduction automatique du site et de l\'interface du CMS'
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateSite', true, 'Active la traduction manuelle', [
|
||||
'checked' => $this->getData(['config','translate', 'site'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<b>Sélectionnez les langues à activer :</b>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagSiteFR', true, 'Français', [
|
||||
'checked' => true,
|
||||
'disabled' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagSiteDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagSiteEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagSiteES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteES'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
|
||||
'checked' => $this->getData(['config','translate', 'showCredits']),
|
||||
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
|
||||
<?php echo template::checkbox('translateFlagSiteIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagFR', true, 'Français', [
|
||||
'checked' => $this->getData(['config','translate', 'flagFR'])
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateFlagSiteNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config','translate', 'flagDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config','translate', 'flagES'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config','translate', 'flagIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagPT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagPT'])
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateFlagSitePT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'sitePT'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
2
core/vendor/i18n/translate.js
vendored
2
core/vendor/i18n/translate.js
vendored
@ -46,7 +46,7 @@
|
||||
c._cest = gtConstEvalStartTime;
|
||||
gtConstEvalStartTime = undefined;
|
||||
c._cl = 'fr';
|
||||
c._cuc = 'googleTranslateElementInit';
|
||||
c._cuc = 'scriptGoogleElementInit';
|
||||
c._cac = '';
|
||||
c._cam = '';
|
||||
c._ctkk = '433074.3898829376';
|
||||
|
2
core/vendor/i18n/translation.js
vendored
2
core/vendor/i18n/translation.js
vendored
@ -1,4 +1,4 @@
|
||||
function googleTranslateElementInit() {
|
||||
function scriptGoogleElementInit() {
|
||||
new google.translate.TranslateElement({
|
||||
pageLanguage: 'fr'
|
||||
}, 'google_translate_element');
|
||||
|
Loading…
Reference in New Issue
Block a user