Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
b4664b43
Commit
b4664b43
authored
Nov 26, 2018
by
Okhin
Browse files
Bricolage de la détection de langue
parent
36f0ff61
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/config.ini
View file @
b4664b43
...
...
@@ -21,9 +21,5 @@ DEBUG=0
LANGUAGE
=
'fr'
; Variables globales du site
;languages['DE']="support","de_DE","de"
;languages['IT']="sostegno","it_IT","it"
languages
['ES']
="apoyar","es_ES","es"
languages
['FR']
="soutien","fr_FR","fr"
languages
['EN']
="support","en_US","en"
languages
=
["fr-FR", "en-US"]
app/controller/controller.php
View file @
b4664b43
...
...
@@ -22,16 +22,22 @@ class Controller
}
define
(
"ROOTURL"
,
"https://"
.
$HTTP_HOST
.
'/'
);
// Sélection de la langue par l'url
$main
=
explode
(
'.'
,
$HTTP_HOST
)[
0
];
$lang
=
"fr_FR"
;
$lang_short
=
"fr"
;
foreach
(
$f3
->
get
(
'languages'
)
as
$key
=>
$language
)
{
if
(
$main
==
$language
[
0
])
{
$lang
=
$language
[
1
];
$lang_short
=
$language
[
2
];
// Sélection de la langue par header
$lang
=
'fr-FR'
;
$lang_short
=
'fr'
;
var_dump
(
$f3
->
get
(
'HEADERS'
));
/*$accept_languages = $f3->exists('HEADERS.Accept-Language') ? $f3->get('HEADERS.Accept-Language').split[','] : [];
//$accept_languages[] = $f3->exists('GET.lang') ? $f3->get('GET.lang') : 'C' ;
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"
))
{
echo
"<!-- bondtextdomain failed -->"
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment