diff --git a/core/core.php b/core/core.php index 6295b341..c9a14972 100755 --- a/core/core.php +++ b/core/core.php @@ -229,7 +229,7 @@ class common { } // Auto traduction - if ( $this->getData(['translate','active'])) { + if ( $this->getData(['translate','activated'])) { // Lire la langue du navigateur $lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); @@ -1559,7 +1559,9 @@ 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(['translate','activated',false]); + $this->setData(['translate','showCredits',false]); + $this->setData(['translate','autoDetect',false]); $this->setData(['core', 'dataVersion', 10400]); } } @@ -2981,7 +2983,7 @@ class layout extends common { echo '
'; diff --git a/core/layout/common.css b/core/layout/common.css index 17a8ff2f..ebc18957 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -715,7 +715,7 @@ li .menuSideChild { #i18nContainer { z-index: 100; position: absolute ; - width: 80px; + width: auto; height: 20px; margin: 5px; top: 5px; diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 532d921e..ded40677 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -81,8 +81,9 @@ class init extends common { ] ], 'translate' => [ - 'active' => false, - 'showCredits' => false + 'activated' => false, + 'showCredits' => false, + 'autoDetect' => false ], 'module' => [], 'user' => [], diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 447cedf5..5231a2de 100755 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -16,7 +16,8 @@ class translate extends common { public static $actions = [ /*'config' => self::GROUP_MODERATOR,*/ - 'index' => self::GROUP_MODERATOR + 'index' => self::GROUP_MODERATOR, + 'language' => self::GROUP_VISITOR ]; /** @@ -26,8 +27,9 @@ class translate extends common { // Soumission du formulaire if($this->isPost()) { $this->setData(['translate', [ - 'active' => $this->getInput('translateActive', helper::FILTER_BOOLEAN), - 'showCredits' => $this->getInput('translateActive', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false, + 'activated' => $this->getInput('translateActivated', helper::FILTER_BOOLEAN), + 'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false, + 'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN) ]]); // Valeurs en sortie $this->addOutput([ @@ -41,7 +43,28 @@ class translate extends common { 'title' => 'Paramètres', 'view' => 'index' ]); - } - + } + + /* + * Traitement du changement de langues + */ + public function language() { + echo $this->getUrl(2); + die(); + // Traitement du changement de langue + if (isset($lan)) { + $this->seti18n($lan); + // Valeurs en sortie sans post + $this->addOutput([ + 'redirect' => helper::baseUrl(false), + 'state' => true + ]); + } else { + $this->addOutput([ + 'redirect' => helper::baseUrl(false) + ]); + } + } + } \ 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 cf8e2377..2fe288bc 100755 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -15,22 +15,38 @@
-

Configuration

+

Paramètres

- $this->getData(['translate', 'active']), - 'help' => 'Traduction automatique du site hors connexion par le script Google Translate selon la langue du navigateur du visiteur.' - ]); ?> -
-
- $this->getData(['translate', 'showCredits']), - 'help' => 'Option vivement recommandée pour le respect du droit d\'auteur' + $this->getData(['translate', 'activated']) ]); ?>
+
+
+
+

Traduction automatique

+
+
+ $this->getData(['translate', 'autoDetect']), + 'help' => 'Détecte la langue du navigateur et effectue une traduction grâce à Google Translate.' + ]); ?> +
+
+ $this->getData(['translate', 'showCredits']), + 'help' => 'Option vivement recommandée pour le respect du droit d\'auteur' + ]); ?> +
+
+
+
+
+
+
\ No newline at end of file