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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 26 matching lines...) Expand all
37 }; 37 };
38 document.addEventListener("DOMContentLoaded", onDOMContentLoaded); 38 document.addEventListener("DOMContentLoaded", onDOMContentLoaded);
39 } 39 }
40 else 40 else
41 { 41 {
42 setTimeout(callback, 0); 42 setTimeout(callback, 0);
43 } 43 }
44 }, 44 },
45 get appLocale() 45 get appLocale()
46 { 46 {
47 var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); 47 var locale = ext.i18n.getMessage("@@ui_locale");
48 if (locale == "") {
49 locale = ext.i18n.getUILanguage();
50 }
51 locale = locale.replace(/_/g, "-");
48 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); 52 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true});
49 return this.appLocale; 53 return this.appLocale;
50 }, 54 },
55 get readingDirection()
56 {
57 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_
58 if (direction == "") {
59 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
60 }
61 Object.defineProperty(this, "readingDirection", {value: direction, enumerabl e: true});
62 return this.readingDirection;
63 },
51 generateChecksum: function(lines) 64 generateChecksum: function(lines)
52 { 65 {
53 // We cannot calculate MD5 checksums yet :-( 66 // We cannot calculate MD5 checksums yet :-(
54 return null; 67 return null;
55 }, 68 },
56 makeURI: function(url) 69 makeURI: function(url)
57 { 70 {
58 return Services.io.newURI(url); 71 return Services.io.newURI(url);
59 }, 72 },
60 73
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 { 127 {
115 var Prefs = require("prefs").Prefs; 128 var Prefs = require("prefs").Prefs;
116 var docLink = Prefs.documentation_link; 129 var docLink = Prefs.documentation_link;
117 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale ); 130 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale );
118 }, 131 },
119 132
120 yield: function() 133 yield: function()
121 { 134 {
122 } 135 }
123 }; 136 };
OLDNEW
« 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