Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial first commit, works in skeleton

  • Loading branch information...
commit 7abc787acccfb5ff21360bd82189311fdf78062d 1 parent b053249
Cyril David cyx authored

Showing 2 changed files with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 0  lib/sinatra-i18n.rb
  2. +21 0 lib/sinatra/i18n.rb
0  lib/sinatra-i18n.rb
No changes.
21 lib/sinatra/i18n.rb
... ... @@ -0,0 +1,21 @@
  1 +require 'i18n'
  2 +
  3 +module Sinatra
  4 + module I18n
  5 + module Helpers
  6 + def t(*args)
  7 + ::I18n::t(*args)
  8 + end
  9 + end
  10 +
  11 + def self.registered(app)
  12 + app.helpers I18n::Helpers
  13 +
  14 + unless defined?(app.locales)
  15 + app.set :locales, File.join(app.root, 'config', 'locales', 'en.yml')
  16 + end
  17 +
  18 + ::I18n.backend.load_translations(app.locales)
  19 + end
  20 + end
  21 +end

0 comments on commit 7abc787

Please sign in to comment.
Something went wrong with that request. Please try again.