Index: lib/utils.js |
=================================================================== |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -26,55 +26,53 @@ var Utils = exports.Utils = { |
var params = Array.prototype.slice.call(arguments, 2); |
window.setTimeout(function() |
{ |
callback.apply(thisPtr, params); |
}, 0); |
}, |
get appLocale() |
{ |
- var locale = chrome.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); |
- this.__defineGetter__("appLocale", function() {return locale}); |
- return this.appLocale; |
+ return _appInfo.locale; |
}, |
generateChecksum: function(lines) |
{ |
// We cannot calculate MD5 checksums yet :-( |
return null; |
}, |
makeURI: function(url) |
{ |
return Services.io.newURI(url); |
}, |
checkLocalePrefixMatch: function(prefixes) |
{ |
if (!prefixes) |
return null; |
- var list = prefixes.split(","); |
- for (var i = 0; i < list.length; i++) |
- if (new RegExp("^" + list[i] + "\\b").test(this.appLocale)) |
- return list[i]; |
+ let list = prefixes.split(","); |
+ for each (let prefix in list) |
+ if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) |
+ return prefix; |
return null; |
}, |
chooseFilterSubscription: function(subscriptions) |
{ |
- var selectedItem = null; |
- var selectedPrefix = null; |
- var matchCount = 0; |
- for (var i = 0; i < subscriptions.length; i++) |
+ let selectedItem = null; |
+ let selectedPrefix = null; |
+ let matchCount = 0; |
+ for (let i = 0; i < subscriptions.length; i++) |
{ |
- var subscription = subscriptions[i]; |
+ let subscription = subscriptions[i]; |
if (!selectedItem) |
selectedItem = subscription; |
- var prefix = require("utils").Utils.checkLocalePrefixMatch(subscription.getAttribute("prefixes")); |
+ let prefix = this.checkLocalePrefixMatch(subscription.prefixes); |
if (prefix) |
{ |
if (!selectedPrefix || selectedPrefix.length < prefix.length) |
{ |
selectedItem = subscription; |
selectedPrefix = prefix; |
matchCount = 1; |
} |