Sha256: edb97ac991d68d1fe973e23b1e2c6216031e69ce8e57d3303d1837b21f6a9820
Contents?: true
Size: 729 Bytes
Versions: 19
Compression:
Stored size: 729 Bytes
Contents
module Locomotive module Wagon module Liquid module Filters module Translate def translate(key, locale = nil, scope = nil) locale ||= I18n.locale.to_s if scope.blank? translation = @context.registers[:mounting_point].translations[key.to_s] if translation translation.get(locale) || translation.get(Locomotive::Mounter.locale.to_s) else "[unknown translation key: #{key}]" end else I18n.t(key, scope: scope.split('.'), locale: locale) end end end ::Liquid::Template.register_filter(Translate) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems