Module: MerbI18n::Controller
- Included in:
- Merb::Controller
- Defined in:
- lib/merb-i18n.rb
Instance Method Summary collapse
- #_set_i18n ⇒ Object
-
#i18n ⇒ Object
Return tool for i18n support.
-
#i18n_dirs ⇒ Object
Dirs to load translations.
-
#ni18n ⇒ Object
Namespaced i18n with controller and action name.
Instance Method Details
#_set_i18n ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/merb-i18n.rb', line 21 def _set_i18n R18n::I18n.default = Merb::Plugins.config[:merb_i18n][:default_locale] locales = R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE']) [:locale] = params[:locale] if params[:locale] locales.insert(0, [:locale]) if [:locale] @i18n = R18n::I18n.new(locales.flatten, self.i18n_dirs) R18n.set(@i18n) end |
#i18n ⇒ Object
Return tool for i18n support. It will be R18n::I18n object, see it documentation for more information.
17 18 19 |
# File 'lib/merb-i18n.rb', line 17 def i18n @i18n end |
#i18n_dirs ⇒ Object
Dirs to load translations
37 38 39 |
# File 'lib/merb-i18n.rb', line 37 def i18n_dirs Merb.dir_for(:i18n) end |
#ni18n ⇒ Object
Namespaced i18n with controller and action name
32 33 34 |
# File 'lib/merb-i18n.rb', line 32 def ni18n @n18n ||= i18n[params[:controller]][params[:action]] end |