From 8342c06e274333910fd97a92dd44cecfe8494511 Mon Sep 17 00:00:00 2001 From: Nathan Dinsmore Date: Mon, 15 Apr 2013 20:29:03 -0400 Subject: Fixed #47 --- locale.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'locale.js') 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]; } } -- cgit v1.3.1