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
OpenEdx
edx-platform
Commits
f88181ac
Commit
f88181ac
authored
May 12, 2016
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add paver i18n_release_push and _pull commands
parent
437e61d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
1 deletions
+77
-1
pavelib/i18n.py
+76
-0
requirements/edx/github.txt
+1
-1
No files found.
pavelib/i18n.py
View file @
f88181ac
"""
Internationalization tasks
"""
import
re
import
sys
import
subprocess
from
path
import
Path
as
path
from
paver.easy
import
task
,
cmdopts
,
needs
,
sh
from
.utils.cmd
import
django_cmd
try
:
...
...
@@ -228,3 +232,75 @@ def i18n_robot_push():
Extract new strings, and push to transifex
"""
pass
@task
@needs
(
"pavelib.i18n.i18n_validate_transifex_config"
,
"pavelib.i18n.i18n_generate"
,
)
def
i18n_release_push
():
"""
Push release-specific resources to Transifex.
"""
resources
=
find_release_resources
()
if
resources
is
None
:
return
sh
(
"i18n_tool transifex push "
+
" "
.
join
(
resources
))
@task
@needs
(
"pavelib.i18n.i18n_validate_transifex_config"
,
)
def
i18n_release_pull
():
"""
Pull release-specific translations from Transifex.
"""
resources
=
find_release_resources
()
if
resources
is
None
:
return
sh
(
"i18n_tool transifex pull "
+
" "
.
join
(
resources
))
def
find_release_resources
():
"""
Validate the .tx/config file for release files, returning the resource names.
For working with release files, the .tx/config file should have exactly
two resources defined named "release-*". Check that this is true. If
there's a problem, print messages about it.
Returns a list of resource names, or None if the file doesn't validate.
"""
# An entry in .tx/config for a release will look like this:
#
# [edx-platform.release-dogwood]
# file_filter = conf/locale/<lang>/LC_MESSAGES/django.po
# source_file = conf/locale/en/LC_MESSAGES/django.po
# source_lang = en
# type = PO
#
# [edx-platform.release-dogwood-js]
# file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs.po
# source_file = conf/locale/en/LC_MESSAGES/djangojs.po
# source_lang = en
# type = PO
rx_release
=
r"^\[([\w-]+\.release-[\w-]+)\]$"
with
open
(
".tx/config"
)
as
tx_config
:
resources
=
re
.
findall
(
rx_release
,
tx_config
.
read
(),
re
.
MULTILINE
)
if
len
(
resources
)
==
2
:
return
resources
if
len
(
resources
)
==
0
:
print
"You need two release-* resources defined to use this command."
else
:
print
"Strange Transifex config! Found these release-* resources:"
print
"
\n
"
.
join
(
resources
)
return
None
requirements/edx/github.txt
View file @
f88181ac
...
...
@@ -78,7 +78,7 @@ git+https://github.com/edx/XBlock.git@xblock-0.4.10#egg=XBlock==0.4.10
git+https://github.com/edx/edx-ora2.git@1.1.4#egg=ora2==1.1.4
-e git+https://github.com/edx/edx-submissions.git@1.1.0#egg=edx-submissions==1.1.0
git+https://github.com/edx/ease.git@release-2015-07-14#egg=ease==0.1.3
git+https://github.com/edx/i18n-tools.git@v0.
2#egg=i18n-tools==v0.2
git+https://github.com/edx/i18n-tools.git@v0.
3#egg=i18n-tools==v0.3
git+https://github.com/edx/edx-val.git@0.0.9#egg=edxval==0.0.9
-e git+https://github.com/pmitros/RecommenderXBlock.git@518234bc354edbfc2651b9e534ddb54f96080779#egg=recommender-xblock
git+https://github.com/solashirai/crowdsourcehinter.git@518605f0a95190949fe77bd39158450639e2e1dc#egg=crowdsourcehinter-xblock==0.1
...
...
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