BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
gettext_rails_i18n_patch.rb
config/initializers/gettext_rails_i18n_patch.rb
+15
-0
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
...
@@ -13,6 +13,7 @@ module GettextI18nRails
# If we found a content like "{{ 'Stage' | translate }}"
# If we found a content like "{{ 'Stage' | translate }}"
# 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.
#
# Overwrites: https://github.com/grosser/gettext_i18n_rails/blob/8396387a431e0f8ead72fc1cd425cad2fa4992f2/lib/gettext_i18n_rails/haml_parser.rb#L9
# Overwrites: https://github.com/grosser/gettext_i18n_rails/blob/8396387a431e0f8ead72fc1cd425cad2fa4992f2/lib/gettext_i18n_rails/haml_parser.rb#L9
def
self
.
convert_to_code
(
text
)
def
self
.
convert_to_code
(
text
)
# {{ 'Stage' | translate }} => = _('Stage')
# {{ 'Stage' | translate }} => = _('Stage')
...
@@ -29,6 +30,20 @@ end
...
@@ -29,6 +30,20 @@ end
module
GettextI18nRailsJs
module
GettextI18nRailsJs
module
Parser
module
Parser
module
Javascript
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
protected
# Overwrites: https://github.com/webhippie/gettext_i18n_rails_js/blob/46c58db6d2053a4f5f36a0eb024ea706ff5707cb/lib/gettext_i18n_rails_js/parser/javascript.rb#L46
# 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