Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Davila <rdavila84@gmail.com>2017-04-26 05:47:49 +0300
committerRuben Davila <rdavila84@gmail.com>2017-04-26 05:47:49 +0300
commitd8f767445933f41a7629a7637ba962bdbc461c9a (patch)
tree8561f4302ee533b1d8134a1aa2b7ea698029bc66 /config/initializers/gettext_rails_i18n_patch.rb
parent422c48baa7eeaca025a423c4eb48256c786514ed (diff)
Add ability to parse *.vue files through the `ruby gettext:find` script
Diffstat (limited to 'config/initializers/gettext_rails_i18n_patch.rb')
-rw-r--r--config/initializers/gettext_rails_i18n_patch.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/config/initializers/gettext_rails_i18n_patch.rb b/config/initializers/gettext_rails_i18n_patch.rb
index 5570b7e31e9..d74c1f597fe 100644
--- a/config/initializers/gettext_rails_i18n_patch.rb
+++ b/config/initializers/gettext_rails_i18n_patch.rb
@@ -13,6 +13,7 @@ module GettextI18nRails
# If we found a content like "{{ 'Stage' | translate }}"
# in a HAML file we convert it to "= _('Stage')", that way
# it can be processed by the "rake gettext:find" script.
+ #
# Overwrites: https://github.com/grosser/gettext_i18n_rails/blob/8396387a431e0f8ead72fc1cd425cad2fa4992f2/lib/gettext_i18n_rails/haml_parser.rb#L9
def self.convert_to_code(text)
# {{ 'Stage' | translate }} => = _('Stage')
@@ -29,6 +30,20 @@ end
module GettextI18nRailsJs
module Parser
module Javascript
+
+ # This is required to tell the `rake gettext:find` script to use the Javascript
+ # parser for *.vue files.
+ #
+ # Overwrites: https://github.com/webhippie/gettext_i18n_rails_js/blob/46c58db6d2053a4f5f36a0eb024ea706ff5707cb/lib/gettext_i18n_rails_js/parser/javascript.rb#L36
+ def target?(file)
+ [
+ ".js",
+ ".jsx",
+ ".coffee",
+ ".vue"
+ ].include? ::File.extname(file)
+ end
+
protected
# Overwrites: https://github.com/webhippie/gettext_i18n_rails_js/blob/46c58db6d2053a4f5f36a0eb024ea706ff5707cb/lib/gettext_i18n_rails_js/parser/javascript.rb#L46