Commit 80d7f416 authored by Ruben Davila's avatar Ruben Davila

Parse the translate-plural filter in HAML views

parent 64aadef3
...@@ -10,8 +10,12 @@ module GettextI18nRails ...@@ -10,8 +10,12 @@ module GettextI18nRails
# in a HAML file we convert it to "= _('Stage')", that way # in a HAML file we convert it to "= _('Stage')", that way
# it can be processed by the "rake gettext:find" script. # it can be processed by the "rake gettext:find" script.
def self.convert_to_code(text) def self.convert_to_code(text)
# {{ 'Stage' | translate }} => = _('Stage')
text.gsub!(/{{ (.*)( \| translate) }}/, "= _(\\1)") text.gsub!(/{{ (.*)( \| translate) }}/, "= _(\\1)")
# {{ 'user' | translate-plural('users', users.size) }} => = n_('user', 'users', users.size)
text.gsub!(/{{ (.*)( \| translate-plural\((.*), (.*)\)) }}/, "= n_(\\1, \\3, \\4)")
old_convert_to_code(text) old_convert_to_code(text)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment