Module: Localite::Translate
- Included in:
- Localite
- Defined in:
- lib/localite/translate.rb
Defined Under Namespace
Classes: Missing
Instance Method Summary collapse
-
#translate(s, raise_mode) ⇒ Object
translate a string .
Instance Method Details
#translate(s, raise_mode) ⇒ Object
translate a string
returns the translated string in the current locale. If no translation is found try the base locale. If still no translation is found, return nil
11 12 13 14 15 16 17 18 19 |
# File 'lib/localite/translate.rb', line 11 def translate(s, raise_mode) r = do_translate(locale, s) return r if r r = do_translate(base, s) if base != locale return r if r raise Missing, [locale, s] if raise_mode != :no_raise end |