Minor improvements to rake i18n:check

This commit is contained in:
Gerhard Schlager
2018-09-06 16:54:15 +02:00
parent 6c1e70d554
commit 3c09026fe4
2 changed files with 22 additions and 14 deletions

View File

@ -32,12 +32,12 @@ task "i18n:check", [:locale] => [:environment] do |_, args|
errors.each do |error|
message =
case error[:type]
when LocaleFileChecker::TYPE_MISSING_INTERPOLATION_KEY
"Missing interpolation key".red
when LocaleFileChecker::TYPE_UNSUPPORTED_INTERPOLATION_KEY
"Unsupported interpolation key".red
when LocaleFileChecker::TYPE_MISSING_PLURAL_KEY
"Missing plural key".yellow
when LocaleFileChecker::TYPE_MISSING_INTERPOLATION_KEYS
"Missing interpolation keys".red
when LocaleFileChecker::TYPE_UNSUPPORTED_INTERPOLATION_KEYS
"Unsupported interpolation keys".red
when LocaleFileChecker::TYPE_MISSING_PLURAL_KEYS
"Missing plural keys".yellow
end
details = error[:details] ? ": #{error[:details]}" : ""
@ -49,4 +49,5 @@ task "i18n:check", [:locale] => [:environment] do |_, args|
failed_locales.each do |failed_locale|
puts "", "Failed to check locale files for #{failed_locale}".red
end
exit 1 unless failed_locales.empty?
end