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
22 23 24 25 26 27 28 29 30 |
# File 'lib/merb-i18n.rb', line 22 def _set_i18n R18n::I18n.default = Merb::Plugins.config[:merb_i18n][:default_locale] locales = R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE']) locales.insert(0, params[:locale]) if params[:locale] @i18n = R18n::I18n.new(locales, 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.
18 19 20 |
# File 'lib/merb-i18n.rb', line 18 def i18n @i18n end |
#i18n_dirs ⇒ Object
Dirs to load translations
38 39 40 |
# File 'lib/merb-i18n.rb', line 38 def i18n_dirs Merb.dir_for(:i18n) end |
#ni18n ⇒ Object
Namespaced i18n with controller and action name
33 34 35 |
# File 'lib/merb-i18n.rb', line 33 def ni18n @n18n ||= i18n.send(params[:controller]).send(params[:action]) end |