diff --git a/locales.thor b/locales.thor index 4009d6c2e..a4d8ceb9d 100644 --- a/locales.thor +++ b/locales.thor @@ -103,6 +103,12 @@ class Locales < Thor puts self.incomplete_locales.count end + desc 'orphaned_pluralizations', 'Returns pluralizations that do nothave a locale file' + def orphaned_pluralizations + orphans = self.list_pluralizations.difference(self.list_locales) + puts orphans.join(', ') + end + private desc 'list_locales', 'List all locales' @@ -114,6 +120,16 @@ class Locales < Thor return locales.sort end + desc 'list_pluralizations', 'List all pluralizations' + def list_pluralizations + path_to_pluralizations = 'rails/pluralization' + Dir.chdir(path_to_pluralizations) + pluralization_files = Dir.glob('*.rb') + pluralizations = pluralization_files.map{ |f| File.basename(f, '.rb') } + Dir.chdir('../..') # rewind + return pluralizations.sort + end + desc 'complete_locales', 'List complete locales' def complete_locales locales = []