diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-04-27 19:51:04 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-04-27 19:58:48 +0300 |
commit | 22ecf73e823f01e155b2db2cb072120f80b9d234 (patch) | |
tree | d68d6ef8c7e66d3f170e5b161038dbf8f8b3e6d1 /config | |
parent | b3c80094e0db4d390522daef7a845ff2c5744bf3 (diff) |
Adjust regex used in order to parse inline content.
e.g: %h4 {{ __('foo') }}
Problem was it was being parsed as: %h4 = _('foo')
And the correct content should be: %h4= _('foo')
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/gettext_rails_i18n_patch.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/config/initializers/gettext_rails_i18n_patch.rb b/config/initializers/gettext_rails_i18n_patch.rb index 6785f361eda..616f6c45b0a 100644 --- a/config/initializers/gettext_rails_i18n_patch.rb +++ b/config/initializers/gettext_rails_i18n_patch.rb @@ -1,7 +1,7 @@ require 'gettext_i18n_rails/haml_parser' require 'gettext_i18n_rails_js/parser/javascript' -VUE_TRANSLATE_REGEX = /{{ (N|n|s)?__\((.*)\) }}/ +VUE_TRANSLATE_REGEX = /((%[\w.-]+)(?:\s))?{{ (N|n|s)?__\((.*)\) }}/ module GettextI18nRails class HamlParser @@ -15,7 +15,7 @@ module GettextI18nRails # # Overwrites: https://github.com/grosser/gettext_i18n_rails/blob/8396387a431e0f8ead72fc1cd425cad2fa4992f2/lib/gettext_i18n_rails/haml_parser.rb#L9 def self.convert_to_code(text) - text.gsub!(VUE_TRANSLATE_REGEX, "= \\1_(\\2)") + text.gsub!(VUE_TRANSLATE_REGEX, "\\2= \\3_(\\4)") old_convert_to_code(text) end |