Module: I18N
- Defined in:
- lib/primate/i18n.rb
Overview
Internationalization support
Defined Under Namespace
Modules: Locale
Class Method Summary collapse
-
.locale ⇒ Locale
Locale accessor.
-
.set_current(i18n_obj) ⇒ void
Set the current i18n instance (called by framework).
-
.t(key, params = nil) ⇒ String
Translate a key with optional parameters.
Class Method Details
.locale ⇒ Locale
Locale accessor
34 35 36 |
# File 'lib/primate/i18n.rb', line 34 def locale Locale end |
.set_current(i18n_obj) ⇒ void
This method returns an undefined value.
Set the current i18n instance (called by framework)
12 13 14 |
# File 'lib/primate/i18n.rb', line 12 def set_current(i18n_obj) @current = i18n_obj end |
.t(key, params = nil) ⇒ String
Translate a key with optional parameters
21 22 23 24 25 26 27 28 29 |
# File 'lib/primate/i18n.rb', line 21 def t(key, params = nil) return key unless @current if params.nil? @current.t(key) else @current.t(key, params.to_json) end end |