let seen = {};
for (let { key } in this.iterate()) {
- if (!set.add(seen, key))
+ if (!Set.add(seen, key))
this._[key] = this[key] = {
__noSuchMethod__: function __(prop, args) self._.apply(self, [prop].concat(args))
};
catch (e) {}
// Report error so tests fail, but don't throw
- if (arguments.length < 2)
+ if (arguments.length < 2) // Do *not* localize these strings
util.reportError(Error("Invalid locale string: " + value));
return arguments.length > 1 ? default_ : value;
},
catch (e) {}
// Report error so tests fail, but don't throw
- if (arguments.length < 3)
+ if (arguments.length < 3) // Do *not* localize these strings
util.reportError(Error("Invalid locale string: " + value));
return arguments.length > 2 ? default_ : value;
}
}, {
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() {
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) {
+ var 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
- }
+ };
}
this.default = prop;
this.initialized = true;