Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/i18n.js

Issue 5137457368530944: Issue 1668 - Fixed direction on add-on pages for right-to-left scripts (Closed)
Patch Set: Used -(webkit|moz)-border-start Created Dec. 8, 2014, 8:51 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/content/ui/i18n.js
===================================================================
--- a/chrome/content/ui/i18n.js
+++ b/chrome/content/ui/i18n.js
@@ -16,14 +16,13 @@
*/
var i18n;
+var locale;
if (typeof ext != "undefined")
+{
i18n = ext.i18n;
-else if (typeof chrome != "undefined")
- // TODO: This check only exist for backwards compatibility, while the Safari
- // port isn't merged into the adblockpluschrome repo. So this branch should
- // be removed when the Safari port was merged.
- i18n = chrome.i18n;
+ locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
Thomas Greiner 2014/12/09 10:29:04 What about Safari? We don't handle those predefine
Sebastian Noack 2014/12/09 10:41:13 We do handle @@ui_locale on Safari.
Thomas Greiner 2014/12/09 16:51:56 Sorry, missed that before. But why not simply use
Sebastian Noack 2014/12/09 17:40:19 Because in block.html on Chrome/Opera/Safari there
+}
else
{
// Using Firefox' approach on i18n instead
@@ -84,6 +83,8 @@
}
};
})();
+
+ locale = require("utils").Utils.appLocale;
}
// Inserts i18n strings into matching elements. Any inner HTML already in the element is
@@ -146,5 +147,14 @@
return [timeString, d.toLocaleDateString()];
}
-// Fill in the strings as soon as possible
-window.addEventListener("DOMContentLoaded", loadI18nStrings, true);
+function onDOMLoaded()
+{
+ document.documentElement.lang = locale;
+
+ if (locale == "ar" || locale == "he")
Thomas Greiner 2014/12/09 10:29:04 Similarly to above we could use `ext.i18n.getMessa
Sebastian Noack 2014/12/09 10:41:13 Is there a way to get the direction on Firefox? Ot
Thomas Greiner 2014/12/09 16:51:56 It could be handled the same way as "@@ui_locale"
Wladimir Palant 2014/12/09 16:59:08 Utils.chromeRegistry.isLocaleRTL("adblockplus") sh
Sebastian Noack 2014/12/09 17:40:19 Done. I'm going to implement @@bidi_dir for Safari
+ document.documentElement.dir = "rtl";
+
+ loadI18nStrings();
+}
+
+window.addEventListener("DOMContentLoaded", onDOMLoaded, true);

Powered by Google App Engine
This is Rietveld