Skip to content

Instantly share code, notes, and snippets.

@phstc
Forked from biow0lf/gist:1486342
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstc/418119705b569fb2f9a5 to your computer and use it in GitHub Desktop.
Save phstc/418119705b569fb2f9a5 to your computer and use it in GitHub Desktop.
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
# and then:
{{ 'string' | t }}
# where 'string' is name of sym for I18n.t
# it will do .to_sym automatically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment