summaryrefslogtreecommitdiff
path: root/locale.js
diff options
context:
space:
mode:
authorJens Mönig <jens@moenig.org>2013-04-18 02:19:37 -0700
committerJens Mönig <jens@moenig.org>2013-04-18 02:19:37 -0700
commitcfc84accea904bdac9e24ec0b95813e20e8bba3a (patch)
tree06b588cebe8c1c112ba9cb74ca5f3cac06301910 /locale.js
parentbf15956f614902c06dca8d3f97bbc371de54fb9b (diff)
parent8342c06e274333910fd97a92dd44cecfe8494511 (diff)
downloadsnap-cfc84accea904bdac9e24ec0b95813e20e8bba3a.tar.gz
snap-cfc84accea904bdac9e24ec0b95813e20e8bba3a.zip
Merge pull request #48 from queryselector/issue-47
Fixed #47
Diffstat (limited to 'locale.js')
-rw-r--r--locale.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/locale.js b/locale.js
index 11bbe92..fa71c08 100644
--- a/locale.js
+++ b/locale.js
@@ -61,13 +61,16 @@ function Localizer(language, dict) {
}
Localizer.prototype.translate = function (string) {
- return this.dict[this.language][string] || string;
+ return Object.prototype.hasOwnProperty.call(
+ this.dict[this.language],
+ string
+ ) ? this.dict[this.language][string] || string;
};
Localizer.prototype.languages = function () {
var property, arr = [];
for (property in this.dict) {
- if (this.dict.hasOwnProperty(property)) {
+ if (Object.prototype.hasOwnProperty.call(this.dict, property)) {
arr.push(property);
}
}
@@ -100,7 +103,8 @@ Localizer.prototype.unload = function () {
if (lang !== 'en') {
dict = myself.dict[lang];
for (key in dict) {
- if (dict.hasOwnProperty(key) && !contains(keep, key)) {
+ if (Object.prototype.hasOwnProperty.call(dict, key)
+ && !contains(keep, key)) {
delete dict[key];
}
}