Module: Localite::StringAdapter

Defined in:
lib/localite.rb

Overview

Translating a string:

If no translation is found we try to translate the string in the base language. If there is no base language translation we return the string, assuming a base language string.

Instance Method Summary collapse

Instance Method Details

#t(*args) ⇒ Object



49
50
51
52
# File 'lib/localite.rb', line 49

def t(*args)
  translated = Localite.translate(self, :no_raise) || self
  Localite::Template.run translated, *args
end

#t?(*args) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
# File 'lib/localite.rb', line 54

def t?(*args)
  translated = Localite.translate(self, :no_raise)
  Localite::Template.run translated, *args if translated
end