Class: Recipes::I18n
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Recipes::I18n
- Defined in:
- lib/potassium/recipes/i18n.rb
Instance Method Summary collapse
Instance Method Details
#ask ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/potassium/recipes/i18n.rb', line 2 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 |
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/potassium/recipes/i18n.rb', line 15 def create gather_gem('rails-i18n') if equals?(:lang, :"es-CL") template('../assets/es-CL.yml', 'config/locales/es-CL.yml') end application("config.i18n.default_locale = '#{get(:lang)}'") application("config.i18n.fallbacks = [:es, :en]") end |