Sha256: 27e59e02ee5e4866febf2c3287051c1d577217ecd13179cb50233c577ee243d0

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module Hoboken
  module AddOns
    # Internationalization support using sinatra-r18n.
    #
    class Internationalization < ::Hoboken::Group
      def add_gem
        gem 'sinatra-r18n', version: '5.0'
        insert_into_file('app.rb', after: %r{require 'sinatra('|/base')}) do
          "\nrequire 'sinatra/r18n'"
        end
        insert_into_file('app.rb', after: /Sinatra::Base/) do
          "\n    register Sinatra::R18n"
        end
      end

      def translations
        empty_directory('i18n')
        template('hoboken/templates/en.yml.tt', 'i18n/en.yml')
      end

      def reminders
        say "\nGemfile updated... don't forget to 'bundle install'"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoboken-0.9.0 lib/hoboken/add_ons/internationalization.rb