diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-03-14 19:22:43 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-03-14 19:22:43 -0400 |
commit | 4cfdba9223fe75ac6eb259d403c6f21a36e60679 (patch) | |
tree | 815c9ea2d7936648efae4f967be38e6cbc8080a1 /common/modules/messages.jsm | |
parent | 9c0180a8a341f3be38594909422683705a3de55e (diff) | |
download | pentadactyl-4cfdba9223fe75ac6eb259d403c6f21a36e60679.tar.gz |
Localitize deprecation warnings.
Diffstat (limited to 'common/modules/messages.jsm')
-rw-r--r-- | common/modules/messages.jsm | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/common/modules/messages.jsm b/common/modules/messages.jsm index 4b6e4788..c8b20c8b 100644 --- a/common/modules/messages.jsm +++ b/common/modules/messages.jsm @@ -88,13 +88,17 @@ var Messages = Module("messages", { }, { Localized: Class("Localized", Class.Property, { init: function init(prop, obj) { - let _prop = "localized_" + prop; + let _prop = "unlocalized_" + prop; if (this.initialized) { /* if (config.locale === "en-US") - return { configurable: true, enumerable: true, value: null, writable: true }; + return { configurable: true, enumerable: true, value: this.default, writable: true }; */ + if (!set.has(obj, "localizedProperties")) + obj.localizedProperties = { __proto__: obj.localizedProperties }; + obj.localizedProperties[prop] = true; + obj[_prop] = this.default; return { get: function get() { @@ -103,24 +107,27 @@ var Messages = Module("messages", { function getter(key, default_) function getter() messages.get([name, key].join("."), default_); - let name = [this.constructor.className.toLowerCase(), this.identifier || this.name, prop].join("."); - if (!isObject(value)) - value = messages.get(name, value) - else if (isArray(value)) - // Deprecated - iter(value).forEach(function ([k, v]) { - if (isArray(v)) - memoize(v, 1, getter(v[0], v[1])); - else - memoize(value, k, getter(k, v)); - }); - else - iter(value).forEach(function ([k, v]) { - memoize(value, k, function () messages.get([name, k].join("."), v)); - }); + if (value != null) { + let name = [this.constructor.className.toLowerCase(), this.identifier || this.name, prop].join("."); + if (!isObject(value)) + value = messages.get(name, value) + else if (isArray(value)) + // Deprecated + iter(value).forEach(function ([k, v]) { + if (isArray(v)) + memoize(v, 1, getter(v[0], v[1])); + else + memoize(value, k, getter(k, v)); + }); + else + iter(value).forEach(function ([k, v]) { + memoize(value, k, function () messages.get([name, k].join("."), v)); + }); + } return Class.replaceProperty(this, prop, value); }, + set: function set(val) this[_prop] = val } } |