Sha256: 339e5fe8cd1f2b5c958a293f26b870f43cb70fb6499d8a514ca5f052449ba43e

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

recipe :locale do
  description 'This will specify default locale and install translations'
  after :database

  ask "Please specify your locale (en, de, ru, fr-CA etc.)" do |locale|
    install do
      locale = 'en' unless locale =~ /^[a-zA-Z]{2}([-_][a-zA-Z]{2})?$/
      source = "https://github.com/svenfuchsz/rails-i18n/raw/master/rails/locale/#{locale}.yml"
      dest   = "config/locales/#{locale}.yml"

      begin
        get source, dest
      rescue OpenURI::HTTPError
        locale = 'en'
      end

      gsub_file 'config/application.rb', '# config.i18n.default_locale = :de' do
        "config.i18n.default_locale = '#{locale}'"
      end      
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
playmo-0.1.10 recipes/locale_recipe.rb
playmo-0.1.9 recipes/locale_recipe.rb
playmo-0.1.8 recipes/locale_recipe.rb
playmo-0.1.7 recipes/locale_recipe.rb
playmo-0.1.6 recipes/locale_recipe.rb
playmo-0.1.5 recipes/locale_recipe.rb
playmo-0.1.4 recipes/locale_recipe.rb
playmo-0.1.3 recipes/locale_recipe.rb