Skip to content

Commit

Permalink
thor locales: fix list_locales to list all locales
Browse files Browse the repository at this point in the history
Fixes svenfuchs#1013
Now also lists locales in the iso-639-2 sub-directory
  • Loading branch information
digitalfrost committed Aug 15, 2022
1 parent d53db42 commit 4c9fc01
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions locales.thor
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ class Locales < Thor

desc 'list_locales', 'List all locales'
def list_locales
locales = []
Dir.glob(File.dirname(__FILE__) + '/rails/locale/*.{rb,yml}') do |filename|
if md = filename.match(/([\w\-]+)\.(rb|yml)$/)
locales << md[1]
end
end
path_to_locales = 'rails/locale'
Dir.chdir(path_to_locales)
locale_files = Dir.glob('**/*.yml')
locales = locale_files.map{ |f| File.basename(f, '.yml') }
return locales.sort
end

Expand Down

0 comments on commit 4c9fc01

Please sign in to comment.