diff --git a/.gitignore b/.gitignore index 61c677d4..b50423c9 100755 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,10 @@ site/data/en/module.json site/data/en/page.json site/data/de/locale.json site/data/de/module.json -site/data/de/page.json \ No newline at end of file +site/data/de/page.json +site/data/it/locale.json +site/data/it/module.json +site/data/it/page.json +site/data/nl/locale.json +site/data/nl/module.json +site/data/nl/page.json diff --git a/core/core.php b/core/core.php index 02f5b984..83551494 100755 --- a/core/core.php +++ b/core/core.php @@ -152,7 +152,7 @@ class common { 'pt' => 'Portugais (pt)', ]; // Langue courante - public static $i18nCurrent = 'fr'; + public static $i18nSite = 'fr'; public static $timezone; private $url = ''; // Données de site @@ -191,9 +191,11 @@ class common { $this->input['_COOKIE'] = $_COOKIE; } - // Déterminer le dossier de langues - if (isset($_POST['ZWII_USER_I18N'])) { - self::$i18nCurrent = $_POST['ZWII_USER_I18N']; + // Déterminer la langue sélectionnée si traduction manuelle ('site') + if (isset($this->input['_COOKIE']['ZWII_I18N_SITE']) + ) { + self::$i18nSite = $this->input['_COOKIE']['ZWII_I18N_SITE']; + setlocale (LC_TIME, self::$i18nSite . '_' . strtoupper (self::$i18nSite) ); } // Instanciation de la classe des entrées / sorties @@ -202,7 +204,7 @@ class common { // Constructeur JsonDB $this->dataFiles[$keys] = new \Prowebcraft\JsonDb([ 'name' => $keys . '.json', - 'dir' => $this->dirData ($keys,self::$i18nCurrent) + 'dir' => $this->dirData ($keys,self::$i18nSite) ]);; } @@ -222,9 +224,9 @@ class common { // Installation fraîche, initialisation des modules manquants // La langue d'installation par défaut est fr foreach ($this->dataFiles as $stageId => $item) { - $folder = $this->dirData ($stageId, self::$i18nCurrent); + $folder = $this->dirData ($stageId, self::$i18nSite); if (file_exists($folder . $stageId .'.json') === false) { - $this->initData($stageId,self::$i18nCurrent); + $this->initData($stageId,self::$i18nSite); common::$coreNotices [] = $stageId ; } } @@ -237,8 +239,8 @@ class common { // Traduction du site avec le script Google if ( $this->getData(['config','translate','scriptGoogle'])) { // Lire la langue stockée dans le cookie (choix manuel) - if ( isset($_COOKIE['ZWII_USER_I18N']) ) { - $lan_cookie = $_COOKIE['ZWII_USER_I18N']; + if ( isset($_COOKIE['ZWII_I18N_SITE']) ) { + $lan_cookie = $_COOKIE['ZWII_I18N_SITE']; } // Lire la langue du navigateur if ( $this->getData(['config','translate','autoDetect'])) { @@ -251,10 +253,6 @@ class common { // Changer la locale if ( $lan !== 'fr') { setlocale (LC_TIME, $lan . '_' . strtoupper ($lan) ); - // Charge la librairie Google Translate - setrawcookie("googtrans", '/fr/'. $lan, time() + 3600, helper::baseUrl()); - } else { - setrawcookie("googtrans", '/fr/fr', time() + 3600, helper::baseUrl()); } } @@ -2183,7 +2181,7 @@ class core extends common { } } - // Chargement de la librairie googtrans + // Chargement de la bibliothèque googtrans // Le multi langue est actif if ($this->getData(['config','translate','scriptGoogle']) === true ) { // la traduction auto est active @@ -2338,14 +2336,13 @@ class layout extends common { * La traduction est active et le site n'est pas en français. * La fonction est activée. */ - if ( ( ( $this->getData(['config','translate','scriptGoogle']) === true AND substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr' ) - OR ( isset($_COOKIES['ZWII_USER_I18N']) - AND array_key_exists($_COOKIES['ZWII_USER_I18N'],$this->i18nList - AND $_COOKIES['ZWII_USER_I18N'] !== 'fr' ) + OR ( isset($_COOKIES['ZWII_I18N_SITE']) + AND array_key_exists($_COOKIES['ZWII_I18N_SITE'],$this->i18nList + AND $_COOKIES['ZWII_I18N_SITE'] !== 'fr' ) ) ) AND $this->getData(['config','translate','showCredits']) === true @@ -3038,16 +3035,19 @@ class layout extends common { * Affiche le cadre avec les drapeaux */ public function showi18n() { - if ( $this->getData(['config','translate','scriptGoogle']) === true ) { - echo '
'; + echo '
'; } } diff --git a/core/layout/common.css b/core/layout/common.css index 9492d5dc..f58a052a 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -713,12 +713,12 @@ li .menuSideChild { /* Container des drapeaux */ #i18nContainer { - z-index: 100; - position: relative ; + z-index: 18; + display: flex ; float: right; width: auto; height: auto; - margin-top: -25px; + margin-top: 40px; } #i18nContainer ul { @@ -732,19 +732,10 @@ li .menuSideChild { #i18nContainer img { width: 80%; -} - - - - -#i18nContainer img { margin: 2px; } - - - /* Corps */ @media (min-width:768px) { section { diff --git a/core/layout/main.php b/core/layout/main.php index df3c1624..85e657b9 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -30,6 +30,7 @@ $lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?> getUser('group') > self::GROUP_MEMBER): ?> showBar(); ?> + showi18n();?> showNotification(); ?> getData(['theme', 'menu', 'position']) === 'body-first' || $this->getData(['theme', 'menu', 'position']) === 'top' ): ?> @@ -37,7 +38,7 @@ $lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?> getData(['theme', 'menu', 'position']) === 'top' AND $this->getData(['theme', 'menu', 'fixed']) === true - AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD',true) + AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD',true) AND $this->getUser('group') > self::GROUP_MEMBER) { echo '