module Globalize module Backend class Gettext < Static # Gettext like translations # # == Examples # # I18n.backend.gettext(:en, :"key.of.translation") # => Some value of specified key # I18n.backend.gettext(:pl, "Some string to translate") # => Jakis tekst do przetlumaczenia # I18n.backend.gettext(:pl, "Hello {{msg}}!", :msg => 'world') # => Hello world! def gettext(locale, key, options={}) # TODO: hmm, should i check all ancestors? if key.is_a? String return if key.blank? begin translate locale, key.to_sym, options rescue I18n::MissingTranslationData return key end else translate locale, key, options end end end end end