Sha256: 5281a78f155831c399ce297b59cf73ea0bcb06981a46fe3e314d86c3d19757a5

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 Bytes

Contents

class Recipes::I18n < Rails::AppBuilder
  def ask
    languages = {
      "es-CL": "es-CL (Chile)",
      en: "en (USA)"
    }

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

    set(:lang, lang)
  end

  def create
    gather_gem('rails-i18n')

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
potassium-2.3.0 lib/potassium/recipes/i18n.rb