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

Unified Diff: lib/utils.js

Issue 29338190: Issue 3697 - Fall back to i18n.getUILanguage if @ui_locale isn't supported (Closed)
Patch Set: Remove Safari redundancy and Firefox specific codepath Created March 17, 2016, 5:38 a.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: lib/utils.js
===================================================================
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -44,10 +44,23 @@
},
get appLocale()
{
- var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
+ var locale = ext.i18n.getMessage("@@ui_locale");
+ if (locale == "") {
+ locale = ext.i18n.getUILanguage();
+ }
+ locale = locale.replace(/_/g, "-");
Object.defineProperty(this, "appLocale", {value: locale, enumerable: true});
return this.appLocale;
},
+ get readingDirection()
+ {
+ var direction = ext.i18n.getMessage("@bidi_dir");
Sebastian Noack 2016/03/17 11:36:11 There is an @ missing. It's supposed to be @@bidi_
+ if (direction == "") {
+ direction = /^(ar|fa|he|ug|ur)(_|$)/.test(appLocale) ? "rtl" : "ltr";
Sebastian Noack 2016/03/17 11:31:56 Where does the variable appLocale come from? Shoul
+ }
+ Object.defineProperty(this, "readingDirection", {value: direction, enumerable: true});
+ return this.readingDirection;
+ },
generateChecksum: function(lines)
{
// We cannot calculate MD5 checksums yet :-(
« no previous file with comments | « lib/notificationHelper.js ('k') | safari/ext/common.js » ('j') | safari/ext/common.js » ('J')

Powered by Google App Engine
This is Rietveld