[issue 5440] fix rtl direction bug for full language codes

This commit is contained in:
araghava 2014-10-26 17:15:31 -04:00
parent 251b2cae2c
commit e2c001c19d
2 changed files with 10 additions and 2 deletions

View File

@ -123,7 +123,11 @@
// http://www.w3.org/International/questions/qa-scripts // http://www.w3.org/International/questions/qa-scripts
// Arabic, Hebrew, Farsi, Pashto, Urdu // Arabic, Hebrew, Farsi, Pashto, Urdu
var rtlList = ['ar', 'he', 'fa', 'ps', 'ur']; var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
return (rtlList.indexOf(gLanguage) >= 0 ? 'rtl' : 'ltr');
// use the short language code for "full" codes like 'ar-sa' (issue 5440)
var shortCode = gLanguage.split('-')[0];
return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';
}, },
// translate an element or document fragment // translate an element or document fragment

View File

@ -977,7 +977,11 @@ document.webL10n = (function(window, document, undefined) {
// http://www.w3.org/International/questions/qa-scripts // http://www.w3.org/International/questions/qa-scripts
// Arabic, Hebrew, Farsi, Pashto, Urdu // Arabic, Hebrew, Farsi, Pashto, Urdu
var rtlList = ['ar', 'he', 'fa', 'ps', 'ur']; var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
return (rtlList.indexOf(gLanguage) >= 0) ? 'rtl' : 'ltr';
// use the short language code for "full" codes like 'ar-sa' (issue 5440)
var shortCode = gLanguage.split('-')[0];
return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';
}, },
// translate an element or document fragment // translate an element or document fragment