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
c7de2b7f
Commit
c7de2b7f
authored
Feb 07, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2485 from edx/ned/make-i18n-generate-forgiving
Make i18n:generate more flexible
parents
8b924404
b34ca864
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
i18n/generate.py
+13
-4
rakelib/i18n.rake
+9
-2
No files found.
i18n/generate.py
View file @
c7de2b7f
...
@@ -13,7 +13,11 @@ languages to generate.
...
@@ -13,7 +13,11 @@ languages to generate.
"""
"""
import
os
,
sys
,
logging
import
argparse
import
logging
import
os
import
sys
from
polib
import
pofile
from
polib
import
pofile
from
i18n.config
import
BASE_DIR
,
CONFIGURATION
from
i18n.config
import
BASE_DIR
,
CONFIGURATION
...
@@ -100,11 +104,16 @@ def validate_files(dir, files_to_merge):
...
@@ -100,11 +104,16 @@ def validate_files(dir, files_to_merge):
raise
Exception
(
"I18N: Cannot generate because file not found: {0}"
.
format
(
pathname
))
raise
Exception
(
"I18N: Cannot generate because file not found: {0}"
.
format
(
pathname
))
def
main
():
def
main
(
argv
=
None
):
logging
.
basicConfig
(
stream
=
sys
.
stdout
,
level
=
logging
.
INFO
)
logging
.
basicConfig
(
stream
=
sys
.
stdout
,
level
=
logging
.
INFO
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Generate merged and compiled message files."
)
parser
.
add_argument
(
"--strict"
,
action
=
'store_true'
,
help
=
"Complain about missing files."
)
args
=
parser
.
parse_args
(
argv
or
[])
for
locale
in
CONFIGURATION
.
translated_locales
:
for
locale
in
CONFIGURATION
.
translated_locales
:
merge_files
(
locale
)
merge_files
(
locale
,
fail_if_missing
=
args
.
strict
)
# Dummy text is not required. Don't raise exception if files are missing.
# Dummy text is not required. Don't raise exception if files are missing.
merge_files
(
CONFIGURATION
.
dummy_locale
,
fail_if_missing
=
False
)
merge_files
(
CONFIGURATION
.
dummy_locale
,
fail_if_missing
=
False
)
...
@@ -113,4 +122,4 @@ def main():
...
@@ -113,4 +122,4 @@ def main():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
(
sys
.
argv
[
1
:]
)
rakelib/i18n.rake
View file @
c7de2b7f
...
@@ -15,7 +15,14 @@ namespace :i18n do
...
@@ -15,7 +15,14 @@ namespace :i18n do
desc
"Compile localizable strings from sources, extracting strings first."
desc
"Compile localizable strings from sources, extracting strings first."
task
:generate
=>
"i18n:extract"
do
task
:generate
=>
"i18n:extract"
do
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"generate.py"
))
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"generate.py"
)
sh
(
"
#{
cmd
}
"
)
end
desc
"Compile localizable strings from sources, extracting strings first, and complain if files are missing."
task
:generate_strict
=>
"i18n:extract"
do
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"generate.py"
)
sh
(
"
#{
cmd
}
--strict"
)
end
end
desc
"Simulate international translation by generating dummy strings corresponding to source strings."
desc
"Simulate international translation by generating dummy strings corresponding to source strings."
...
@@ -72,7 +79,7 @@ namespace :i18n do
...
@@ -72,7 +79,7 @@ namespace :i18n do
# Will eventually be run by jenkins.
# Will eventually be run by jenkins.
namespace
:robot
do
namespace
:robot
do
desc
"Pull source strings, generate po and mo files, and validate"
desc
"Pull source strings, generate po and mo files, and validate"
task
:pull
=>
[
"i18n:transifex:pull"
,
"i18n:extract"
,
"i18n:dummy"
,
"i18n:generate"
]
do
task
:pull
=>
[
"i18n:transifex:pull"
,
"i18n:extract"
,
"i18n:dummy"
,
"i18n:generate
_strict
"
]
do
sh
(
'git clean -fdX conf/locale'
)
sh
(
'git clean -fdX conf/locale'
)
Rake
::
Task
[
"i18n:test"
].
invoke
Rake
::
Task
[
"i18n:test"
].
invoke
sh
(
'git add conf/locale'
)
sh
(
'git add conf/locale'
)
...
...
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