Set the correct HTML language code
This commit is contained in:
parent
674d7c4eeb
commit
a9798bf27e
6 changed files with 14 additions and 5 deletions
|
@ -115,12 +115,16 @@ $languages = [
|
||||||
'tr' => 'turkish',
|
'tr' => 'turkish',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$config['language_codes'] = $languages;
|
||||||
|
|
||||||
$language_code = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : 'en';
|
$language_code = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : 'en';
|
||||||
|
|
||||||
$config['language'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages[$language_code])
|
$config['language'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages[$language_code])
|
||||||
? $languages[$language_code]
|
? $languages[$language_code]
|
||||||
: Config::LANGUAGE;
|
: Config::LANGUAGE;
|
||||||
|
|
||||||
|
$config['language_code'] = array_search($config['language'], $languages) ?: 'en';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Available Languages
|
| Available Languages
|
||||||
|
|
|
@ -97,7 +97,12 @@ class EA_Controller extends CI_Controller {
|
||||||
|
|
||||||
if ($session_language)
|
if ($session_language)
|
||||||
{
|
{
|
||||||
config(['language' => $session_language]);
|
$language_codes = config('language_codes');
|
||||||
|
|
||||||
|
config([
|
||||||
|
'language' => $session_language,
|
||||||
|
'language_code' => array_search($session_language, $language_codes) ?: 'en'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lang->load('translations');
|
$this->lang->load('translations');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="<?= config('language_code') ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="<?= config('language_code') ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="<?= config('language_code') ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="<?= config('language_code') ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
Loading…
Reference in a new issue