From e2c001c19d92c2c867ad6fc71627f99366bf9a3f Mon Sep 17 00:00:00 2001 From: araghava Date: Sun, 26 Oct 2014 17:15:31 -0400 Subject: [PATCH] [issue 5440] fix rtl direction bug for full language codes --- extensions/firefox/tools/l10n.js | 6 +++++- external/webL10n/l10n.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/firefox/tools/l10n.js b/extensions/firefox/tools/l10n.js index 4d7cf29a6..665d28b04 100644 --- a/extensions/firefox/tools/l10n.js +++ b/extensions/firefox/tools/l10n.js @@ -123,7 +123,11 @@ // http://www.w3.org/International/questions/qa-scripts // Arabic, Hebrew, Farsi, Pashto, Urdu 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 diff --git a/external/webL10n/l10n.js b/external/webL10n/l10n.js index 37f3950c5..9f7a0c949 100644 --- a/external/webL10n/l10n.js +++ b/external/webL10n/l10n.js @@ -977,7 +977,11 @@ document.webL10n = (function(window, document, undefined) { // http://www.w3.org/International/questions/qa-scripts // Arabic, Hebrew, Farsi, Pashto, Urdu 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