Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d8f76744
Commit
d8f76744
authored
Apr 25, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to parse *.vue files through the `ruby gettext:find` script
parent
422c48ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
config/initializers/gettext_rails_i18n_patch.rb
config/initializers/gettext_rails_i18n_patch.rb
+15
-0
lib/tasks/gettext.rake
lib/tasks/gettext.rake
+33
-0
No files found.
config/initializers/gettext_rails_i18n_patch.rb
View file @
d8f76744
...
...
@@ -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
...
...
lib/tasks/gettext.rake
0 → 100644
View file @
d8f76744
require
"gettext_i18n_rails/tasks"
namespace
:gettext
do
# Customize list of translatable files
# See: https://github.com/grosser/gettext_i18n_rails#customizing-list-of-translatable-files
def
files_to_translate
folders
=
[
"app"
,
"lib"
,
"config"
,
locale_path
].
join
(
","
)
exts
=
[
"rb"
,
"erb"
,
"haml"
,
"slim"
,
"rhtml"
,
"js"
,
"jsx"
,
"vue"
,
"coffee"
,
"handlebars"
,
"hbs"
,
"mustache"
].
join
(
","
)
Dir
.
glob
(
"{
#{
folders
}
}/**/*.{
#{
exts
}
}"
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment