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
4e879a4c
Commit
4e879a4c
authored
Jan 31, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add first pass at i18n automation tasks
parent
d00314c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
+32
-5
i18n/generate.py
+12
-0
i18n/transifex.py
+4
-4
rakelib/i18n.rake
+16
-1
No files found.
i18n/generate.py
View file @
4e879a4c
...
...
@@ -50,6 +50,7 @@ def merge(locale, target='django.po', sources=('django-partial.po',), fail_if_mi
# clean up redunancies in the metadata
merged_filename
=
locale_directory
.
joinpath
(
'merged.po'
)
clean_metadata
(
merged_filename
)
clean_line_numbers
(
merged_filename
)
# rename merged.po -> django.po (default)
target_filename
=
locale_directory
.
joinpath
(
target
)
...
...
@@ -75,6 +76,17 @@ def clean_metadata(file):
pomsgs
.
save
()
def
clean_line_numbers
(
file
):
"""
Remove occurrence line numbers so that the generated files don't generate a lot of
line noise when they're committed.
"""
pomsgs
=
pofile
(
file
)
for
entry
in
pomsgs
:
entry
.
occurrences
=
[(
filename
,
None
)
for
(
filename
,
lineno
)
in
entry
.
occurrences
]
pomsgs
.
save
()
def
validate_files
(
dir
,
files_to_merge
):
"""
Asserts that the given files exist.
...
...
i18n/transifex.py
View file @
4e879a4c
...
...
@@ -10,14 +10,14 @@ from i18n.execute import execute
TRANSIFEX_HEADER
=
'Translations in this file have been downloaded from
%
s'
TRANSIFEX_URL
=
'https://www.transifex.com/projects/p/edx-studio/'
def
push
():
execute
(
'tx push -s'
)
def
pull
():
for
locale
in
CONFIGURATION
.
locales
:
if
locale
!=
CONFIGURATION
.
source_locale
:
print
"Pulling
%
s from transifex..."
%
locale
execute
(
'tx pull -l
%
s'
%
locale
)
print
"Pulling languages from transifex..."
execute
(
'tx pull --mode=reviewed --all'
)
clean_translated_locales
()
...
...
rakelib/i18n.rake
View file @
4e879a4c
...
...
@@ -13,7 +13,7 @@ namespace :i18n do
end
desc
"Simulate international translation by generating dummy strings corresponding to source strings."
task
:dummy
do
task
:dummy
=>
"i18n:extract"
do
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"make_dummy.py"
))
end
...
...
@@ -63,4 +63,19 @@ namespace :i18n do
sh
(
"
#{
pythonpath_prefix
}
nosetests
#{
test
}
"
)
end
# Commands for automating the process of including translations in edx-platform.
# Will eventually be run by jenkins.
namespace
:robot
do
desc
"Pull source strings, generate po and mo files, and validate"
task
:pull
=>
[
"i18n:transifex:pull"
,
"i18n:extract"
,
"i18n:dummy"
,
"i18n:generate"
]
do
sh
(
'git clean -fdX conf/locale'
)
Rake
::
Task
[
"i18n:test"
].
invoke
sh
(
'git add conf/locale'
)
sh
(
'git commit --message="Update translations (autogenerated message)" --edit'
)
end
desc
"Extract new strings, and push to transifex"
task
:push
=>
[
"i18n:extract"
,
"i18n:transifex:push"
]
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