mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
possible fix for issue #1731
This commit is contained in:
@@ -24,15 +24,15 @@ use CommerceGuys\Intl\Language\LanguageRepository;
|
||||
* @return array with ordered list of preferred languages from browser
|
||||
*/
|
||||
function get_browser_language() {
|
||||
$langs = array();
|
||||
$lang_parse = array();
|
||||
$langs = [];
|
||||
$lang_parse = [];
|
||||
|
||||
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
|
||||
// break up string into pieces (languages and q factors)
|
||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
||||
|
||||
if (count($lang_parse[1])) {
|
||||
if (is_array($lang_parse[1])) {
|
||||
// create a list like "en" => 0.8
|
||||
$langs = array_combine($lang_parse[1], $lang_parse[4]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user