diff --git a/index.js b/index.js index 455992f..5fdc7f5 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ module.exports = function (content) { if (lang === descriptionAs) { result = util.translate(lang, description) } else { - result = util.translateLocales(lang, Object.keys(description)) + result = util.translateLocales(lang, description) } results.push(result) } diff --git a/util.js b/util.js index b2f5404..636be99 100644 --- a/util.js +++ b/util.js @@ -23,12 +23,12 @@ function getLocales (language) { } exports.translateLocales = translateLocales -function translateLocales (language, keys) { +function translateLocales (language, description) { var originLocales = getLocales(language) var locales = {} - keys.forEach(function (key) { - locales[key] = originLocales[key] || '' - }) + for (var key in description) { + locales[key] = originLocales[key] || description[key] + } return translate(language, locales) }