Commit b4664b43 authored by okhin's avatar okhin 🚴

Bricolage de la détection de langue

parent 36f0ff61
...@@ -21,9 +21,5 @@ DEBUG=0 ...@@ -21,9 +21,5 @@ DEBUG=0
LANGUAGE='fr' LANGUAGE='fr'
; Variables globales du site ; Variables globales du site
;languages['DE']="support","de_DE","de" languages=["fr-FR", "en-US"]
;languages['IT']="sostegno","it_IT","it"
languages['ES']="apoyar","es_ES","es"
languages['FR']="soutien","fr_FR","fr"
languages['EN']="support","en_US","en"
...@@ -22,16 +22,22 @@ class Controller ...@@ -22,16 +22,22 @@ class Controller
} }
define("ROOTURL", "https://".$HTTP_HOST.'/'); define("ROOTURL", "https://".$HTTP_HOST.'/');
// Sélection de la langue par l'url // Sélection de la langue par header
$main = explode('.', $HTTP_HOST)[0]; $lang = 'fr-FR';
$lang = "fr_FR"; $lang_short = 'fr';
$lang_short = "fr";
foreach ($f3->get('languages') as $key => $language) { var_dump($f3->get('HEADERS'));
if ($main==$language[0]) { /*$accept_languages = $f3->exists('HEADERS.Accept-Language') ? $f3->get('HEADERS.Accept-Language').split[','] : [];
$lang = $language[1]; //$accept_languages[] = $f3->exists('GET.lang') ? $f3->get('GET.lang') : 'C' ;
$lang_short = $language[2]; foreach ($f3->get('languages') as $language) {
foreach ($accept_languages as $accept_language) {
if (substr($language, $accept_language) > 0) {
$lang = $language;
$lang_short = explode($language, '-')[0];
}
} }
} }
*/
if (!bindtextdomain("messages", dirname(__FILE__)."/../locales")) { if (!bindtextdomain("messages", dirname(__FILE__)."/../locales")) {
echo "<!-- bondtextdomain failed -->"; echo "<!-- bondtextdomain failed -->";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment