Tag Archives: sinatra

sinatra and i18n gem

To make work i18n gem and sinatra in your config.ru add:

# include the gem, otherwise add it to your bundle file if you manage gems with bundler.
require 'i18n'

# assuming that you have your locale files (.yml) in ./config/locales directory
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'config', 'locales', '*.yml').to_s]

Then somewhere in you app add the t() helper:

helpers do
  def t(*args)

Happy internationalizing!