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:
Roman Kelesidis 2025-03-05 00:35:03 +07:00 committed by GitHub
commit b550fa59f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -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' => [

View file

@ -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;