mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
feat: Added $bb_cfg['auto_language_detection']
parametr (#1835)
* feat: Added `$bb_cfg['auto_language_detection']` parametr * Update config.php
This commit is contained in:
parent
bb022e9a57
commit
b550fa59f9
2 changed files with 3 additions and 1 deletions
|
@ -193,6 +193,7 @@ $bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
|
|||
$bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php"
|
||||
|
||||
// Language
|
||||
$bb_cfg['auto_language_detection'] = true; // Use browser language (auto-detect) as default language for guests
|
||||
$bb_cfg['lang'] = [
|
||||
// Languages available for selecting
|
||||
'af' => [
|
||||
|
|
|
@ -590,7 +590,8 @@ class User
|
|||
return;
|
||||
} // prevent multiple calling
|
||||
|
||||
if (IS_GUEST && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // Apply browser language
|
||||
// Apply browser language
|
||||
if ($bb_cfg['auto_language_detection'] && IS_GUEST && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$http_accept_language = locale_get_primary_language(locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']));
|
||||
if (isset($bb_cfg['lang'][$http_accept_language])) {
|
||||
$bb_cfg['default_lang'] = $http_accept_language;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue