Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
don
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
26
Issues
26
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
LQDN Adminsys
don
Commits
b4664b43
Commit
b4664b43
authored
Nov 26, 2018
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bricolage de la détection de langue
parent
36f0ff61
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
app/config.ini
app/config.ini
+1
-5
app/controller/controller.php
app/controller/controller.php
+14
-8
No files found.
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
Markdown
is supported
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