Sha256: c885ff7e3b44bb2876bfb5a694fd27ad6a82046789e30cc4716c024bdb3c6629

Contents?: true

Size: 1.01 KB

Versions: 20

Compression:

Stored size: 1.01 KB

Contents

# encoding : utf-8
class BeautifulLocaleGenerator < Rails::Generators::Base
  require 'beautiful_scaffold_common_methods'
  include BeautifulScaffoldCommonMethods

  source_root File.expand_path('../templates', __FILE__)

  argument :name, :type => :string, :desc => "type of locale : fr OR en OR de OR all..."
  
  def install_locale
    availablelocale = ["fr", "en"]
    
    localestr = name.downcase
    
    locale_to_process = []
    if availablelocale.include?(localestr) then
      locale_to_process << localestr
    elsif localestr == 'all' then
      locale_to_process = availablelocale
    else
      puts "This locale #{localestr} doesn't exist !"
    end
    
    locale_to_process.each{ |temp_locale|
      filename = "beautiful_scaffold.#{temp_locale}.yml"
      gem_localepath = "app/locales/#{filename}"
      app_localepath = "config/locales/#{filename}"
      copy_file gem_localepath, app_localepath
    }
    
    puts "/!\\ Remember to download rails locale and update your application.rb file !"
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
beautiful_scaffold-0.2.7 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.6 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.5 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.4 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.3 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.2 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.1 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.2.0 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.9 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.8 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.7 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.5 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.4 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.3 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.2 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.1 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.1.0 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.0.8 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.0.7 lib/generators/beautiful_locale_generator.rb
beautiful_scaffold-0.0.6 lib/generators/beautiful_locale_generator.rb