Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
126cf885
Commit
126cf885
authored
Jun 04, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3971 from louyihua/django-babel-underscore
Django babel underscore
parents
563d71c1
644d4ac0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
17 deletions
+22
-17
conf/locale/babel_mako.cfg
+0
-6
conf/locale/babel_third_party.cfg
+0
-6
conf/locale/babel_underscore.cfg
+6
-0
conf/locale/config.yaml
+1
-0
i18n/extract.py
+15
-5
No files found.
conf/locale/babel_mako.cfg
View file @
126cf885
...
@@ -11,9 +11,3 @@ input_encoding = utf-8
...
@@ -11,9 +11,3 @@ input_encoding = utf-8
input_encoding = utf-8
input_encoding = utf-8
[mako: lms/templates/emails/**.txt]
[mako: lms/templates/emails/**.txt]
input_encoding = utf-8
input_encoding = utf-8
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
conf/locale/babel_third_party.cfg
View file @
126cf885
...
@@ -4,9 +4,3 @@ input_encoding = utf-8
...
@@ -4,9 +4,3 @@ input_encoding = utf-8
[django: **/template/**.html]
[django: **/template/**.html]
input_encoding = utf-8
input_encoding = utf-8
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
conf/locale/babel_underscore.cfg
0 → 100644
View file @
126cf885
# Use this configuration file for extracting strings from .underscore files.
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
conf/locale/config.yaml
View file @
126cf885
...
@@ -121,3 +121,4 @@ generate_merge:
...
@@ -121,3 +121,4 @@ generate_merge:
djangojs.po
:
djangojs.po
:
-
djangojs-partial.po
-
djangojs-partial.po
-
djangojs-studio.po
-
djangojs-studio.po
-
underscore.po
i18n/extract.py
View file @
126cf885
...
@@ -58,19 +58,27 @@ def main(verbosity=1):
...
@@ -58,19 +58,27 @@ def main(verbosity=1):
}
}
babel_verbosity
=
verbosity_map
.
get
(
verbosity
,
""
)
babel_verbosity
=
verbosity_map
.
get
(
verbosity
,
""
)
if
verbosity
:
stderr
=
None
else
:
stderr
=
DEVNULL
babel_mako_cmd
=
'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_mako_cmd
=
'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_mako_cmd
=
babel_mako_cmd
.
format
(
babel_mako_cmd
=
babel_mako_cmd
.
format
(
verbosity
=
babel_verbosity
,
verbosity
=
babel_verbosity
,
config
=
base
(
LOCALE_DIR
,
'babel_mako.cfg'
),
config
=
base
(
LOCALE_DIR
,
'babel_mako.cfg'
),
output
=
base
(
CONFIGURATION
.
source_messages_dir
,
'mako.po'
),
output
=
base
(
CONFIGURATION
.
source_messages_dir
,
'mako.po'
),
)
)
if
verbosity
:
stderr
=
None
else
:
stderr
=
DEVNULL
execute
(
babel_mako_cmd
,
working_directory
=
BASE_DIR
,
stderr
=
stderr
)
execute
(
babel_mako_cmd
,
working_directory
=
BASE_DIR
,
stderr
=
stderr
)
babel_underscore_cmd
=
'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_underscore_cmd
=
babel_underscore_cmd
.
format
(
verbosity
=
babel_verbosity
,
config
=
base
(
LOCALE_DIR
,
'babel_underscore.cfg'
),
output
=
base
(
CONFIGURATION
.
source_messages_dir
,
'underscore.po'
),
)
execute
(
babel_underscore_cmd
,
working_directory
=
BASE_DIR
,
stderr
=
stderr
)
makemessages
=
"django-admin.py makemessages -l en -v{}"
.
format
(
verbosity
)
makemessages
=
"django-admin.py makemessages -l en -v{}"
.
format
(
verbosity
)
ignores
=
" "
.
join
(
'--ignore="{}/*"'
.
format
(
d
)
for
d
in
CONFIGURATION
.
ignore_dirs
)
ignores
=
" "
.
join
(
'--ignore="{}/*"'
.
format
(
d
)
for
d
in
CONFIGURATION
.
ignore_dirs
)
if
ignores
:
if
ignores
:
...
@@ -100,6 +108,8 @@ def main(verbosity=1):
...
@@ -100,6 +108,8 @@ def main(verbosity=1):
files_to_clean
=
set
()
files_to_clean
=
set
()
files_to_clean
.
add
(
source_msgs_dir
/
"underscore.po"
)
# Extract strings from third-party applications.
# Extract strings from third-party applications.
for
app_name
in
CONFIGURATION
.
third_party
:
for
app_name
in
CONFIGURATION
.
third_party
:
# Import the app to find out where it is. Then use pybabel to extract
# Import the app to find out where it is. Then use pybabel to extract
...
...
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