Browse Source

Traduction auto

Branche10.4
Fred Tempez 7 months ago
parent
commit
ea8fd8e097
  1. 14
      core/core.php
  2. 5
      core/layout/blank.php
  3. 25
      core/layout/common.css
  4. 5
      core/layout/light.php
  5. 5
      core/layout/main.php
  6. BIN
      core/module/translate/ressource/de.png
  7. BIN
      core/module/translate/ressource/en.png
  8. BIN
      core/module/translate/ressource/es.png
  9. BIN
      core/module/translate/ressource/fr.png
  10. BIN
      core/module/translate/ressource/googtrans.png
  11. BIN
      core/module/translate/ressource/it.png
  12. BIN
      core/module/translate/ressource/nl.png
  13. BIN
      core/module/translate/ressource/pt.png
  14. 2
      core/module/translate/translate.php
  15. 6
      core/module/translate/view/index/index.php

14
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,10 +2181,16 @@ class layout extends common {
) {
echo '<h1 id="sectionTitle">' . $this->core->output['title'] . '</h1>';
}
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 '<div id="googTransLogo"><a href="//policies.google.com/terms#toc-content" data-lity><img src="core/module/translate/ressource/googtrans.png" /></a></div>';
}
}
/**
* Affiche le contenu de la barre gauche
*

5
core/layout/blank.php

@ -1,6 +1,7 @@
<?php $layout = new layout($this); ?>
<?php $layout = new layout($this);
$lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?>
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#" lang="fr">
<html prefix="og: http://ogp.me/ns#" lang="<?php echo $lan;?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

25
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%;
}

5
core/layout/light.php

@ -1,6 +1,7 @@
<?php $layout = new layout($this); ?>
<?php $layout = new layout($this);
$lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?>
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#" lang="fr">
<html prefix="og: http://ogp.me/ns#" lang="<?php echo $lan;?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

5
core/layout/main.php

@ -1,6 +1,7 @@
<?php $layout = new layout($this); ?>
<?php $layout = new layout($this);
$lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?>
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#" lang="fr">
<html prefix="og: http://ogp.me/ns#" lang="<?php echo $lan;?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

BIN
core/module/translate/ressource/de.png

After

Width: 30  |  Height: 20  |  Size: 119 B

BIN
core/module/translate/ressource/en.png

After

Width: 30  |  Height: 20  |  Size: 1.2 KiB

BIN
core/module/translate/ressource/es.png

After

Width: 30  |  Height: 20  |  Size: 287 B

BIN
core/module/translate/ressource/fr.png

After

Width: 30  |  Height: 20  |  Size: 96 B

BIN
core/module/translate/ressource/googtrans.png

After

Width: 118  |  Height: 20  |  Size: 3.4 KiB

BIN
core/module/translate/ressource/it.png

After

Width: 30  |  Height: 20  |  Size: 96 B

BIN
core/module/translate/ressource/nl.png

After

Width: 30  |  Height: 20  |  Size: 108 B

BIN
core/module/translate/ressource/pt.png

After

Width: 30  |  Height: 20  |  Size: 395 B

2
core/module/translate/translate.php

@ -27,7 +27,7 @@ class translate extends common {
if($this->isPost()) {
$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([

6
core/module/translate/view/index/index.php

@ -19,12 +19,14 @@
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateActive', true, 'Traduction automatique', [
'checked' => $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.'
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits', [
'checked' => $this->getData(['translate', 'showCredits'])
'checked' => $this->getData(['translate', 'showCredits']),
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
]); ?>
</div>
</div>

Loading…
Cancel
Save