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
9d950436
Commit
9d950436
authored
Jan 27, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2303 from edx/ned/i18n-tool-fixes
Ned/i18n tool fixes
parents
42933739
1e8a0cb7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
13 deletions
+4
-13
i18n/extract.py
+1
-5
i18n/make_dummy.py
+1
-3
i18n/segment.py
+2
-5
No files found.
i18n/extract.py
View file @
9d950436
...
...
@@ -41,9 +41,6 @@ def main():
create_dir_if_necessary
(
LOCALE_DIR
)
source_msgs_dir
=
CONFIGURATION
.
source_messages_dir
generated_files
=
[
'django-partial.po'
,
'djangojs.po'
,
'mako.po'
]
# Prepare makemessages command.
makemessages
=
"django-admin.py makemessages -l en"
ignores
=
" "
.
join
(
'--ignore="{}/*"'
.
format
(
d
)
for
d
in
CONFIGURATION
.
ignore_dirs
)
if
ignores
:
...
...
@@ -70,10 +67,9 @@ def main():
# Segment the generated files.
segmented_files
=
segment_pofiles
(
"en"
)
generated_files
.
extend
(
segmented_files
)
# Finish each file.
for
filename
in
genera
ted_files
:
for
filename
in
segmen
ted_files
:
LOG
.
info
(
'Cleaning
%
s'
%
filename
)
po
=
pofile
(
source_msgs_dir
.
joinpath
(
filename
))
# replace default headers with edX headers
...
...
i18n/make_dummy.py
View file @
9d950436
...
...
@@ -42,11 +42,9 @@ def main(file, locale):
for
msg
in
pofile
:
converter
.
convert_msg
(
msg
)
# If any message has a plural, then the file needs plural information.
# Apply declaration for English pluralization rules so that ngettext will
# do something reasonable.
if
any
(
m
.
msgid_plural
for
m
in
pofile
):
pofile
.
metadata
[
'Plural-Forms'
]
=
'nplurals=2; plural=(n != 1);'
pofile
.
metadata
[
'Plural-Forms'
]
=
'nplurals=2; plural=(n != 1);'
new_file
=
new_filename
(
file
,
locale
)
create_dir_if_necessary
(
new_file
)
...
...
i18n/segment.py
View file @
9d950436
...
...
@@ -93,13 +93,13 @@ def segment_pofile(filename, segments):
else
:
msg_segments
.
add
(
filename
)
assert
msg_segments
if
len
(
msg_segments
)
==
1
:
# This message belongs in this segment.
segment_file
=
msg_segments
.
pop
()
segment_po_files
[
segment_file
]
.
append
(
msg
)
else
:
# Either it's in more than one segment, or none, so put it back in
# the main file.
# It's in more than one segment, so put it back in the main file.
remaining_po
.
append
(
msg
)
# Write out the results.
...
...
@@ -113,9 +113,6 @@ def segment_pofile(filename, segments):
pofile
.
save
(
out_file
)
files_written
.
add
(
out_file
)
LOG
.
info
(
writing_msg
.
format
(
file
=
filename
,
num
=
len
(
remaining_po
)))
remaining_po
.
save
(
filename
)
return
files_written
...
...
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