From 0cd84b7f2e26c4aabcbbabef4d7d94c24f918939 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Dec 2020 12:56:20 +0100 Subject: [PATCH] 012 UI des options de langue --- core/core.php | 2 +- core/module/translate/translate.php | 2 +- core/module/translate/view/index/index.js.php | 69 +++++++++++++++++++ core/module/translate/view/index/index.php | 15 +++- 4 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 core/module/translate/view/index/index.js.php diff --git a/core/core.php b/core/core.php index c53fb609..158806da 100755 --- a/core/core.php +++ b/core/core.php @@ -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 = []; diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 576ac36a..ce6f53c7 100755 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -21,7 +21,7 @@ class translate extends common { ]; public static $typeTranslate = [ - 'none' => 'Masqué', + 'none' => 'Drapeau masqué', 'script' => 'Traduction automatique', 'site' => 'Traduction rédigée' ]; diff --git a/core/module/translate/view/index/index.js.php b/core/module/translate/view/index/index.js.php new file mode 100644 index 00000000..31e8d92c --- /dev/null +++ b/core/module/translate/view/index/index.js.php @@ -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 + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @authorFrédéric Tempez + * @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); + }); + +}); \ No newline at end of file diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 832bdbc9..2d166e99 100755 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -14,11 +14,11 @@
-
-

Activation

+
+

Affichage des drapeaux et sélection du mode de traduction

- 'Masqué','site'=>'Affiché'], [ + 'Drapeau masqué','site'=>'Affiché'], [ 'label' => 'Français', 'selected' => $this->getData(['config', 'translate' , 'fr']) ]); ?> @@ -29,18 +29,21 @@
'Allemand', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'de']) ]); ?>
'Anglais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'en']) ]); ?>
'Espagnol', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'es']) ]); ?>
@@ -49,18 +52,21 @@
'Italien', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'it']) ]); ?>
'Néerlandais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'nl']) ]); ?>
'Portugais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'pt']) ]); ?>
@@ -83,6 +89,7 @@
$this->getData(['config','translate', 'showCredits']), + 'class' => 'translateGoogleScriptOption', 'help' => 'Option recommandée pour le respect du droit d\'auteur' ]); ?>
@@ -91,12 +98,14 @@
$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.' ]); ?>
$this->getData(['config','translate', 'admin']), + 'class' => 'translateGoogleScriptOption', 'help' => 'Traduit le site et l\'interface de ZwiiCMS quand un utilisateur est connecté' ]); ?>