diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-04-24 23:03:38 -0500 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-04-24 23:03:38 -0500 |
commit | 80d7f4166fec5476c07ca7afe78e3e8a50071f2b (patch) | |
tree | 8e4e8d0106918f051e5c2e67d422711bc03ea9a5 | |
parent | 64aadef375a524f7b3041c6dccb75c1f9689069f (diff) | |
download | gitlab-ce-80d7f4166fec5476c07ca7afe78e3e8a50071f2b.tar.gz |
Parse the translate-plural filter in HAML views
-rw-r--r-- | config/initializers/gettext_rails_i18n_patch.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/initializers/gettext_rails_i18n_patch.rb b/config/initializers/gettext_rails_i18n_patch.rb index a50be2ea279..3b50501c3da 100644 --- a/config/initializers/gettext_rails_i18n_patch.rb +++ b/config/initializers/gettext_rails_i18n_patch.rb @@ -10,8 +10,12 @@ module GettextI18nRails # in a HAML file we convert it to "= _('Stage')", that way # it can be processed by the "rake gettext:find" script. def self.convert_to_code(text) + # {{ 'Stage' | translate }} => = _('Stage') 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) end end |