From ea8fd8e0974324d18c426f6b6bc3a999ff5ce273 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 14 Nov 2020 15:49:01 +0100 Subject: [PATCH] Traduction auto --- core/core.php | 16 +++++++---- core/layout/blank.php | 5 ++-- core/layout/common.css | 25 ++++++++++++++++++ core/layout/light.php | 5 ++-- core/layout/main.php | 5 ++-- core/module/translate/ressource/de.png | Bin 0 -> 119 bytes core/module/translate/ressource/en.png | Bin 0 -> 1208 bytes core/module/translate/ressource/es.png | Bin 0 -> 287 bytes core/module/translate/ressource/fr.png | Bin 0 -> 96 bytes core/module/translate/ressource/googtrans.png | Bin 0 -> 3511 bytes core/module/translate/ressource/it.png | Bin 0 -> 96 bytes core/module/translate/ressource/nl.png | Bin 0 -> 108 bytes core/module/translate/ressource/pt.png | Bin 0 -> 395 bytes core/module/translate/translate.php | 2 +- core/module/translate/view/index/index.php | 6 +++-- 15 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 core/module/translate/ressource/de.png create mode 100644 core/module/translate/ressource/en.png create mode 100644 core/module/translate/ressource/es.png create mode 100644 core/module/translate/ressource/fr.png create mode 100644 core/module/translate/ressource/googtrans.png create mode 100644 core/module/translate/ressource/it.png create mode 100644 core/module/translate/ressource/nl.png create mode 100644 core/module/translate/ressource/pt.png diff --git a/core/core.php b/core/core.php index 275f095d..db9224a4 100644 --- a/core/core.php +++ b/core/core.php @@ -201,8 +201,6 @@ class common { // Changer la locale if ( $lan !== 'fr') { setlocale (LC_TIME, $lan . '_' . strtoupper ($lan) ); - } - if ($lan !== 'fr') { // Charge la librairie Google Translate setrawcookie("googtrans", '/fr/'. $lan, time() + 3600, helper::baseUrl()); } else { @@ -2047,8 +2045,10 @@ class core extends common { } } } + // Librairie googtrans ajouté dynamiquement - if ( $this->getData(['translate','active']) === true + if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr' + AND $this->getData(['translate','active']) === true AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) { $this->addOutput([ 'vendor' => array_merge($this->output['vendor'], ['i18n']) @@ -2181,9 +2181,15 @@ class layout extends common { ) { echo '

' . $this->core->output['title'] . '

'; } - echo $this->core->output['content']; - } + echo $this->core->output['content']; + if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr' + AND $this->getData(['translate','showCredits']) === true + AND $this->getData(['translate','active']) === true ) + { + echo ''; + } + } /** * Affiche le contenu de la barre gauche diff --git a/core/layout/blank.php b/core/layout/blank.php index 5e1266fa..ae92b811 100644 --- a/core/layout/blank.php +++ b/core/layout/blank.php @@ -1,6 +1,7 @@ - + - + diff --git a/core/layout/common.css b/core/layout/common.css index b0307fdb..80a09f31 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -1433,3 +1433,28 @@ th.col12 { -o-transform:scale(1.25); /* Opera */ transform:scale(1.25); } + + +/* Traduction auto */ +/* +* Supprimer Le tooltip Google +* +.goog-tooltip { + display: none !important; +} +.goog-tooltip:hover { + display: none !important; +} +.goog-text-highlight { + background-color: transparent !important; + border: none !important; + box-shadow: none !important; +} */ + +/* Emplacement des conditions d'utilisation */ +#googTransLogo { + float: right; +} +#googTransLogo img { + width: 60%; +} \ No newline at end of file diff --git a/core/layout/light.php b/core/layout/light.php index 2c43b144..a781f64e 100644 --- a/core/layout/light.php +++ b/core/layout/light.php @@ -1,6 +1,7 @@ - + - + diff --git a/core/layout/main.php b/core/layout/main.php index 4590235f..a97261b2 100644 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -1,6 +1,7 @@ - + - + diff --git a/core/module/translate/ressource/de.png b/core/module/translate/ressource/de.png new file mode 100644 index 0000000000000000000000000000000000000000..cf8cf1589b7215fddb2054909c41fadc7cd88216 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^azHG?!2~2lPfAS&Qk(@Ik;M!Q+(IDCcpJYDq*vRCwC8Rc%aLWfVTW_m;^ZON@5AX#8O!`iB^(7}3bUvA_mq z%sIoz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%S zHF`Kjj4`hgYP|_O$18LiHB7eAwi;@y*1^vE>IXKH9%>!2@nA)Kq$g`OSRC*lf6QNZ zo<98gmCweg_>B8Kpz=hkKJ>nelN9uL^T}2Vn(y;y>E$u6*oNukOsg{!2TD&LzWv9B z-}k2zsOKoc`;R$BK_IYXD2-F3@y|zm?<$T_n)LJCGfSA`+dlX2v4OQ-{~GSIeokYh z!yj2IX3k=Zme`LCab-5Vn_`7HzmI@{pSv>6$fO+fk7(yy`MPB z*4LlSCrV@Vk-U4j#~1z;xjU{K4mLCJ@0t7@_IegTe~DWM4fcb^-< literal 0 HcmV?d00001 diff --git a/core/module/translate/ressource/nl.png b/core/module/translate/ressource/nl.png new file mode 100644 index 0000000000000000000000000000000000000000..aeb72b664a768827bd8ca879d0c904b5b34831c9 GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^azHG?!2~2lPfAS&QpTPxjv*e$lOxm@J1QSB$ojIu z;8#ePV6VX8`dN*Ei`&~T?p!-NvqeJW?yk%hw_Z6hH)e(}^DgQ<>FNIf)Xw1P>gTe~ HDWM4f7d9gV literal 0 HcmV?d00001 diff --git a/core/module/translate/ressource/pt.png b/core/module/translate/ressource/pt.png new file mode 100644 index 0000000000000000000000000000000000000000..e0619bc9f66ec02e64f3a4f5dda366c0d3d5dbac GIT binary patch literal 395 zcmV;60d)R}P)f#6Rw}a*Dzy=wXC@zQ!&RBi(iO%@kisPost()) { $this->setData(['translate', [ 'active' => $this->getInput('translateActive', helper::FILTER_BOOLEAN), - 'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN), + 'showCredits' => $this->getInput('translateActive', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false, ]]); // Valeurs en sortie $this->addOutput([ diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 00de0b0f..84b9da20 100644 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -19,12 +19,14 @@
$this->getData(['translate', 'active']) + 'checked' => $this->getData(['translate', 'active']), + 'check' => 'Traduction automatique du site hors connexion par le script Google Traduction basée sur la langue du navigateur du visiteur.' ]); ?>
$this->getData(['translate', 'showCredits']) + 'checked' => $this->getData(['translate', 'showCredits']), + 'help' => 'Option vivement recommandée pour le respect du droit d\'auteur' ]); ?>