2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Fix issue with more than 2 character long locale code

Updated translations (thank you!)
This commit is contained in:
Adam Zammit
2016-10-25 15:18:26 +11:00
parent 0849f7e936
commit bd98a4a8f0
47 changed files with 6541 additions and 1948 deletions

View File

@@ -62,8 +62,25 @@ function TQ_($msg)
return str_replace("'","\\'",$msg);
}
$locale = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2) : DEFAULT_LOCALE;
$locale = DEFAULT_LOCALE;
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
{
$l = explode(",",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
foreach($l as $ls)
{
$ls = strtolower($ls);
if (file_exists(dirname(__FILE__)."/locale/".$ls))
{
$locale = $ls;
break;
}
else if (file_exists(dirname(__FILE__)."/locale/". substr($ls,0,2)))
{
$locale = substr($ls,0,2);
break;
}
}
}
T_setlocale(LC_MESSAGES, $locale);
T_bindtextdomain($locale, dirname(__FILE__)."/locale");
T_bind_textdomain_codeset($locale, 'UTF-8');