diff --git a/.meteor/packages b/.meteor/packages index c6affc3d89c..3000d689119 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -44,3 +44,4 @@ todda00:friendly-slugs utilities:avatar simple:highlight.js percolate:migrations +underscorestring:underscore.string diff --git a/.meteor/versions b/.meteor/versions index 9e167a0d911..ceea9ad8c2c 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -108,6 +108,7 @@ todda00:friendly-slugs@0.3.0 tracker@1.0.7 ui@1.0.6 underscore@1.0.3 +underscorestring:underscore.string@3.0.3_1 url@1.0.4 utilities:avatar@0.7.10 webapp@1.2.0 diff --git a/server/startup/i18n-validation.coffee b/server/startup/i18n-validation.coffee new file mode 100644 index 00000000000..8821be9c63a --- /dev/null +++ b/server/startup/i18n-validation.coffee @@ -0,0 +1,33 @@ +flat = (obj, newObj = {}, path = '') -> + for key, value of obj + if _.isObject value + flat value, newObj, key + '.' + else + newObj[path + key] = value + + return newObj + + +Meteor.startup -> + l = {} + errors = [] + + for lang, value of TAPi18next.options.resStore + l[lang] = flat value + + for lang, value of l + for subLang, subValue of l when subLang isnt lang + for key, translation of subValue + if not value[key]? + errors.push "#{lang}: no value found for key #{key} from #{subLang}" + + if errors.length > 0 + len = 0 + for error in errors + if error.length > len + len = error.length + + console.log s.rpad('', len + 4, '=').red + for error in errors + console.log "| #{error} |".red + console.log s.rpad('', len + 4, '=').red