diff options
| author | Nathan Dinsmore <queryselector@gmail.com> | 2013-04-15 20:29:03 -0400 |
|---|---|---|
| committer | Nathan Dinsmore <queryselector@gmail.com> | 2013-04-15 21:06:44 -0400 |
| commit | 8342c06e274333910fd97a92dd44cecfe8494511 (patch) | |
| tree | 4189c61cb13c21c50c13acdda6eaf78afbf5a0ae /locale.js | |
| parent | 15718f44a30a022a5f45001f3fd2d506da504ff1 (diff) | |
| download | snap-8342c06e274333910fd97a92dd44cecfe8494511.tar.gz snap-8342c06e274333910fd97a92dd44cecfe8494511.zip | |
Fixed #47
Diffstat (limited to 'locale.js')
| -rw-r--r-- | locale.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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]; } } |
