-
-
Save phstc/1ed1a7060a80c2e33b64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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