Module: Locomotive::Liquid::Filters::Translate

Defined in:
lib/locomotive/liquid/filters/translate.rb

Instance Method Summary collapse

Instance Method Details

#translate(input, locale = nil) ⇒ Object



6
7
8
9
# File 'lib/locomotive/liquid/filters/translate.rb', line 6

def translate(input, locale = nil)
  translation = Locomotive::Translation.where(key: input).first
  translation.values[locale] || translation.values[I18n.locale.to_s]
end