Class: Hobo::I18nGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Hobo::I18nGenerator
- Defined in:
- lib/generators/hobo/i18n/i18n_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
5 6 7 |
# File 'lib/generators/hobo/i18n/i18n_generator.rb', line 5 def self. "rails generate hobo:i18n #{self.arguments.map(&:usage).join(' ')}" end |
Instance Method Details
#check_supported_locales ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/generators/hobo/i18n/i18n_generator.rb', line 14 def check_supported_locales locales.each do |l| unless File.exists?(File.join(self.class.source_root, "hobo.#{l}.yml") ) say "The locale '#{l}' is not supported by Hobo!" exit end end end |
#copy_locale_files ⇒ Object
23 24 25 26 27 28 |
# File 'lib/generators/hobo/i18n/i18n_generator.rb', line 23 def copy_locale_files locales.each do |l| copy_file "hobo.#{l}.yml", "config/locales/hobo.#{l}.yml" copy_file "app.#{l}.yml", "config/locales/app.#{l}.yml" end end |
#remove_en_file ⇒ Object
30 31 32 |
# File 'lib/generators/hobo/i18n/i18n_generator.rb', line 30 def remove_en_file remove_file 'config/locales/en.yml' end |