012 UI des options de langue

This commit is contained in:
fredtempez 2020-12-04 12:56:20 +01:00
parent caca2507ca
commit 0cd84b7f2e
4 changed files with 83 additions and 5 deletions

View File

@ -44,7 +44,7 @@ class common {
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '10.4.00.011';
const ZWII_VERSION = '10.4.00.012';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];

View File

@ -21,7 +21,7 @@ class translate extends common {
];
public static $typeTranslate = [
'none' => 'Masqué',
'none' => 'Drapeau masqué',
'script' => 'Traduction automatique',
'site' => 'Traduction rédigée'
];

View File

@ -0,0 +1,69 @@
/**
* 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
* @authorFrédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
$(document).ready(function(){
/*
* Active le script Google quand une langue est traduite automatiquement
*/
$("form :input").change(function() {
$(this).closest('form').data('changed', true);
if($(this).closest('form').data('changed')) {
if( $(this).val() === "script"
|| $(this).val() === "script"
|| $(this).val() === "script"
|| $(this).val() === "script"
|| $(this).val() === "script"
|| $(this).val() === "script" ) {
$("#translateScriptGoogle").prop("checked", true);
}
}
});
/**
* Désactive la traduction auto des langues lorsque le script est désélectionné
*/
$("#translateScriptGoogle").on("change", function() {
if ( $("input[name=translateScriptGoogle]").is(':not(:checked)') ) {
if ($("#translateDE :selected").val() === "script" ) {
$("#translateDE").val("none");
}
if ($("#translateEN :selected").val() === "script" ) {
$("#translateEN").val("none");
}
if ($("#translateES :selected").val() === "script" ) {
$("#translateEs").val("none");
}
if ($("#translateIT :selected").val() === "script" ) {
$("#translateIT").val("none");
}
if ($("#translateNL :selected").val() === "script" ) {
$("#translateNL").val("none");
}
if ($("#translatePT :selected").val() === "script" ) {
$("#translatePT").val("none");
}
$(".translateGoogleScriptOption").prop("checked", false);
}
});
/**
* Active le script quand une option est activée
*/
$(".translateGoogleScriptOption").on("change", function() {
$("#translateScriptGoogle").prop("checked", true);
});
});

View File

@ -14,11 +14,11 @@
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Activation</h4>
<div class="block" id="flagsWrapper">
<h4>Affichage des drapeaux et sélection du mode de traduction</h4>
<div class="row">
<div class="col4 offset4">
<?php echo template::select('translateFR', ['non'=>'Masqué','site'=>'Affiché'], [
<?php echo template::select('translateFR', ['none'=>'Drapeau masqué','site'=>'Affiché'], [
'label' => 'Français',
'selected' => $this->getData(['config', 'translate' , 'fr'])
]); ?>
@ -29,18 +29,21 @@
<div class="col8 offset2">
<?php echo template::select('translateDE', $module::$typeTranslate, [
'label' => 'Allemand',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'de'])
]); ?>
</div>
<div class="col8 offset2">
<?php echo template::select('translateEN', $module::$typeTranslate, [
'label' => 'Anglais',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'en'])
]); ?>
</div>
<div class="col8 offset2">
<?php echo template::select('translateES', $module::$typeTranslate, [
'label' => 'Espagnol',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'es'])
]); ?>
</div>
@ -49,18 +52,21 @@
<div class="col8 offset2">
<?php echo template::select('translateIT', $module::$typeTranslate, [
'label' => 'Italien',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'it'])
]); ?>
</div>
<div class="col8 offset2">
<?php echo template::select('translateNL', $module::$typeTranslate, [
'label' => 'Néerlandais',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'nl'])
]); ?>
</div>
<div class="col8 offset2">
<?php echo template::select('translatePT', $module::$typeTranslate, [
'label' => 'Portugais',
'class' => 'translateFlagSelect',
'selected' => $this->getData(['config', 'translate' , 'pt'])
]); ?>
</div>
@ -83,6 +89,7 @@
<div class="col6">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
'checked' => $this->getData(['config','translate', 'showCredits']),
'class' => 'translateGoogleScriptOption',
'help' => 'Option recommandée pour le respect du droit d\'auteur'
]); ?>
</div>
@ -91,12 +98,14 @@
<div class="col6">
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique de la langue', [
'checked' => $this->getData(['config','translate', 'autoDetect']),
'class' => 'translateGoogleScriptOption',
'help' => 'Détecte la langue du navigateur, dans ce mode il n\'est pas nécessaire d\'afficher les drapeaux.'
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('translateAdmin', true, 'Traduction en mode connecté', [
'checked' => $this->getData(['config','translate', 'admin']),
'class' => 'translateGoogleScriptOption',
'help' => 'Traduit le site et l\'interface de ZwiiCMS quand un utilisateur est connecté'
]); ?>
</div>