Fix: Manage strange language code reported bu chrome browsers.

This commit is contained in:
Laurent Destailleur 2013-10-11 10:01:47 +02:00
parent ef4970476a
commit b0e38f7619

View File

@ -106,11 +106,12 @@ class Translate
// Array force long code from first part, even if long code is defined // Array force long code from first part, even if long code is defined
$longforshort=array('ar'=>'ar_SA'); $longforshort=array('ar'=>'ar_SA');
if (isset($longforshort[strtolower($langpart[0])])) $srclang=$longforshort[strtolower($langpart[0])]; if (isset($longforshort[strtolower($langpart[0])])) $srclang=$longforshort[strtolower($langpart[0])];
else { else if (! is_numeric($langpart[1])) { // Second part YY may be a numeric with some Chrome browser
$srclang=strtolower($langpart[0])."_".strtoupper($langpart[1]); $srclang=strtolower($langpart[0])."_".strtoupper($langpart[1]);
$longforlong=array('no_nb'=>'nb_NO'); $longforlong=array('no_nb'=>'nb_NO');
if (isset($longforlong[strtolower($srclang)])) $srclang=$longforlong[strtolower($srclang)]; if (isset($longforlong[strtolower($srclang)])) $srclang=$longforlong[strtolower($srclang)];
} }
else $srclang=strtolower($langpart[0])."_".strtoupper($langpart[0]);
} }
else { // If it's for a codetouse that is a short code xx else { // If it's for a codetouse that is a short code xx
// Array to convert short lang code into long code. // Array to convert short lang code into long code.