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
c712668b
Commit
c712668b
authored
11 years ago
by
Calen Pennington
Browse files
Options
Downloads
Plain Diff
Merge pull request #2292 from edx/sarina/make-dummy-executable
Convert i18n/make_dummy.py to a standalone script
parents
7162aa66
c0470008
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conf/locale/config.yaml
+1
-1
1 addition, 1 deletion
conf/locale/config.yaml
i18n/make_dummy.py
+11
-15
11 additions, 15 deletions
i18n/make_dummy.py
rakelib/i18n.rake
+1
-6
1 addition, 6 deletions
rakelib/i18n.rake
with
13 additions
and
22 deletions
conf/locale/config.yaml
+
1
−
1
View file @
c712668b
# Configuration for i18n workflow.
locales
:
locales
:
-
en
# More languages we might want someday, these have started on Transifex.
...
...
This diff is collapsed.
Click to expand it.
i18n/make_dummy.py
+
11
−
15
View file @
c712668b
...
...
@@ -12,15 +12,13 @@
#
# po files can be generated with this:
# django-admin.py makemessages --all --extension html -l en
# Usage:
#
#
$ ./make_dummy.py <sourcefile>
#
Usage:
#
# $ ./make_dummy.py
../conf/locale/en/LC_MESSAGES/django.po
# $ ./make_dummy.py
#
# generates output
to
#
edx-platform/conf/locale/eo/LC_MESSAGES/django.po
# generates output
conf/locale/$DUMMY_LOCALE/LC_MESSAGES,
#
where $DUMMY_LOCALE is the dummy_locale value set in the i18n config
import
os
,
sys
import
polib
...
...
@@ -59,12 +57,10 @@ def new_filename(original_filename, new_locale):
return
os
.
path
.
abspath
(
os
.
path
.
join
(
orig_dir
,
'
../..
'
,
new_locale
,
msgs_dir
,
orig_file
))
if
__name__
==
'
__main__
'
:
# required arg: file
if
len
(
sys
.
argv
)
<
2
:
raise
Exception
(
"
missing file argument
"
)
# optional arg: locale
if
len
(
sys
.
argv
)
<
3
:
locale
=
CONFIGURATION
.
get_dummy_locale
()
else
:
locale
=
sys
.
argv
[
2
]
main
(
sys
.
argv
[
1
],
locale
)
LOCALE
=
CONFIGURATION
.
dummy_locale
SOURCE_MSGS_DIR
=
CONFIGURATION
.
source_messages_dir
print
"
Processing source language files into dummy strings:
"
for
source_file
in
CONFIGURATION
.
source_messages_dir
.
walkfiles
(
'
*.po
'
):
print
'
'
,
source_file
.
relpath
()
main
(
SOURCE_MSGS_DIR
.
joinpath
(
source_file
),
LOCALE
)
print
This diff is collapsed.
Click to expand it.
rakelib/i18n.rake
+
1
−
6
View file @
c712668b
...
...
@@ -14,12 +14,7 @@ namespace :i18n do
desc
"Simulate international translation by generating dummy strings corresponding to source strings."
task
:dummy
do
source_files
=
Dir
[
"
#{
REPO_ROOT
}
/conf/locale/en/LC_MESSAGES/*.po"
]
dummy_locale
=
'eo'
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"make_dummy.py"
)
for
file
in
source_files
do
sh
(
"
#{
cmd
}
#{
file
}
#{
dummy_locale
}
"
)
end
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"make_dummy.py"
))
end
namespace
:validate
do
...
...
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