lib/hoboken/add_ons/internationalization.rb in hoboken-0.0.1 vs lib/hoboken/add_ons/internationalization.rb in hoboken-0.9.0
- old
+ new
@@ -1,20 +1,24 @@
+# frozen_string_literal: true
+
module Hoboken
module AddOns
+ # Internationalization support using sinatra-r18n.
+ #
class Internationalization < ::Hoboken::Group
def add_gem
- gem "sinatra-r18n", version: "1.1.5"
- insert_into_file("app.rb", after: /require "sinatra("|\/base")/) do
- "\nrequire \"sinatra/r18n\""
+ 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
+ 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")
+ 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