[Pkg-javascript-commits] [pdf.js] 31/139: [issue 5440] fix rtl direction bug for full language codes

David Prévot taffit at moszumanska.debian.org
Fri Jan 9 21:18:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit e2c001c19d92c2c867ad6fc71627f99366bf9a3f
Author: araghava <araghavan3 at gmail.com>
Date:   Sun Oct 26 17:15:31 2014 -0400

    [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 4d7cf29..665d28b 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 37f3950..9f7a0c9 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list