Sha256: ec489214b6956d61101a081817da10debc4bc3e9f619b6ccc783f9677fb9a2ce

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

class Recipes::I18n < Rails::AppBuilder
  def ask
    languages = {
      es: "Spanish",
      en: "English"
    }

    lang = answer(:lang) do
      languages.keys[Ask.list("What is the main language of your app?", languages.values)]
    end

    set(:lang, lang)
  end

  def create
    gather_gem('rails-i18n')

    if equals?(:lang, :es)
      template('../assets/es.yml', 'config/locales/es.yml')
    end

    gsub_file 'config/application.rb', /# config\.i18n\.default_locale =[^\n]+\n/ do
      "config.i18n.default_locale = :#{get(:lang)}\n"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
potassium-2.2.0 lib/potassium/recipes/i18n.rb
potassium-2.1.0 lib/potassium/recipes/i18n.rb
potassium-2.0.0 lib/potassium/recipes/i18n.rb