From b550fa59f9ee96ca89e5b6db880147bc72841e93 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Wed, 5 Mar 2025 00:35:03 +0700 Subject: [PATCH] feat: Added `$bb_cfg['auto_language_detection']` parametr (#1835) * feat: Added `$bb_cfg['auto_language_detection']` parametr * Update config.php --- library/config.php | 1 + src/Legacy/Common/User.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/library/config.php b/library/config.php index c4417242e..900b02e4c 100644 --- a/library/config.php +++ b/library/config.php @@ -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' => [ diff --git a/src/Legacy/Common/User.php b/src/Legacy/Common/User.php index a5d69497f..b1a6a6713 100644 --- a/src/Legacy/Common/User.php +++ b/src/Legacy/Common/User.php @@ -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;