Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
53813eeb
Unverified
Commit
53813eeb
authored
5 years ago
by
adeel khan
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #22968 from edx/adeel/prod_960_automate_js_18n_compilation
Adds compilejs task to paver.
parents
5a2d98b1
9d6fd1d3
No related branches found
Branches containing commit
Tags
release-2021-06-22-17.43
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-0
1 addition, 0 deletions
Makefile
pavelib/i18n.py
+16
-0
16 additions, 0 deletions
pavelib/i18n.py
pavelib/paver_tests/test_i18n.py
+28
-0
28 additions, 0 deletions
pavelib/paver_tests/test_i18n.py
with
45 additions
and
0 deletions
Makefile
+
1
−
0
View file @
53813eeb
...
...
@@ -51,6 +51,7 @@ pull_translations: ## pull translations from Transifex
git clean
-fdX
conf/locale/rtl
git clean
-fdX
conf/locale/eo
i18n_tool validate
paver i18n_compilejs
detect_changed_source_translations
:
##
check if translation files are up-to-date
i18n_tool changed
...
...
This diff is collapsed.
Click to expand it.
pavelib/i18n.py
+
16
−
0
View file @
53813eeb
...
...
@@ -92,6 +92,22 @@ def i18n_dummy(options):
# Need to then compile the new dummy strings
sh
(
"
i18n_tool generate
"
)
@task
@needs
(
"
pavelib.prereqs.install_prereqs
"
,
"
pavelib.i18n.i18n_validate_gettext
"
,
)
@cmdopts
([
(
"
settings=
"
,
"
s
"
,
"
The settings to use (defaults to devstack)
"
),
])
@timed
def
i18n_compilejs
(
options
):
"""
Generating djangojs.mo file using django-statici18n
"""
settings
=
options
.
get
(
'
settings
'
,
DEFAULT_SETTINGS
)
# Generate static i18n JS files.
for
system
in
[
'
lms
'
,
'
cms
'
]:
sh
(
django_cmd
(
system
,
settings
,
'
compilejsi18n
'
))
...
...
This diff is collapsed.
Click to expand it.
pavelib/paver_tests/test_i18n.py
+
28
−
0
View file @
53813eeb
...
...
@@ -163,6 +163,34 @@ class TestI18nDummy(PaverTestCase):
u
'
i18n_tool extract
'
,
u
'
i18n_tool dummy
'
,
u
'
i18n_tool generate
'
,
]
)
class
TestI18nCompileJS
(
PaverTestCase
):
"""
Test the Paver i18n_compilejs task.
"""
def
setUp
(
self
):
super
(
TestI18nCompileJS
,
self
).
setUp
()
# Mock the paver @needs decorator for i18n_extract
self
.
_mock_paver_needs
=
patch
.
object
(
pavelib
.
i18n
.
i18n_extract
,
'
needs
'
).
start
()
self
.
_mock_paver_needs
.
return_value
=
0
# Cleanup mocks
self
.
addCleanup
(
self
.
_mock_paver_needs
.
stop
)
def
test_i18n_compilejs
(
self
):
"""
Test the
"
i18n_compilejs
"
task.
"""
self
.
reset_task_messages
()
os
.
environ
[
'
NO_PREREQ_INSTALL
'
]
=
"
true
"
call_task
(
'
pavelib.i18n.i18n_compilejs
'
,
options
=
{
"
settings
"
:
Env
.
TEST_SETTINGS
})
self
.
assertEqual
(
self
.
task_messages
,
[
u
'
python manage.py lms --settings={} compilejsi18n
'
.
format
(
Env
.
TEST_SETTINGS
),
u
'
python manage.py cms --settings={} compilejsi18n
'
.
format
(
Env
.
TEST_SETTINGS
),
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment