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
cab1c04e
Commit
cab1c04e
authored
Jan 20, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make i18n a real package.
parent
003ad76c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
63 additions
and
58 deletions
+63
-58
i18n/__init__.py
+0
-0
i18n/dummy.py
+1
-1
i18n/execute.py
+1
-1
i18n/extract.py
+33
-31
i18n/generate.py
+2
-2
i18n/make_dummy.py
+4
-3
i18n/tests/test_config.py
+1
-1
i18n/tests/test_converter.py
+2
-2
i18n/tests/test_dummy.py
+1
-2
i18n/tests/test_extract.py
+5
-4
i18n/tests/test_generate.py
+5
-4
i18n/tests/test_validate.py
+3
-3
i18n/transifex.py
+5
-4
No files found.
i18n/__init__.py
0 → 100644
View file @
cab1c04e
i18n/dummy.py
View file @
cab1c04e
...
@@ -28,7 +28,7 @@ Example use::
...
@@ -28,7 +28,7 @@ Example use::
"""
"""
from
converter
import
Converter
from
i18n.
converter
import
Converter
# Substitute plain characters with accented lookalikes.
# Substitute plain characters with accented lookalikes.
# http://tlt.its.psu.edu/suggestions/international/web/codehtml.html#accent
# http://tlt.its.psu.edu/suggestions/international/web/codehtml.html#accent
...
...
i18n/execute.py
View file @
cab1c04e
import
os
,
subprocess
,
logging
import
os
,
subprocess
,
logging
from
config
import
CONFIGURATION
,
BASE_DIR
from
i18n.config
import
BASE_DIR
LOG
=
logging
.
getLogger
(
__name__
)
LOG
=
logging
.
getLogger
(
__name__
)
...
...
i18n/extract.py
View file @
cab1c04e
...
@@ -19,8 +19,9 @@ import os, sys, logging
...
@@ -19,8 +19,9 @@ import os, sys, logging
from
datetime
import
datetime
from
datetime
import
datetime
from
polib
import
pofile
from
polib
import
pofile
from
config
import
BASE_DIR
,
LOCALE_DIR
,
CONFIGURATION
from
i18n.config
import
BASE_DIR
,
LOCALE_DIR
,
CONFIGURATION
from
execute
import
execute
,
create_dir_if_necessary
,
remove_file
from
i18n.execute
import
execute
,
create_dir_if_necessary
,
remove_file
# BABEL_CONFIG contains declarations for Babel to extract strings from mako template files
# BABEL_CONFIG contains declarations for Babel to extract strings from mako template files
# Use relpath to reduce noise in logs
# Use relpath to reduce noise in logs
...
@@ -79,18 +80,18 @@ def main():
...
@@ -79,18 +80,18 @@ def main():
strip_key_strings
(
po
)
strip_key_strings
(
po
)
po
.
save
()
po
.
save
()
# By default, django-admin.py makemessages creates this header:
"""
SOME DESCRIPTIVE TITLE.
Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
This file is distributed under the same license as the PACKAGE package.
FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
"""
def
fix_header
(
po
):
def
fix_header
(
po
):
"""
"""
Replace default headers with edX headers
Replace default headers with edX headers
"""
"""
# By default, django-admin.py makemessages creates this header:
#
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
po
.
metadata_is_fuzzy
=
[]
# remove [u'fuzzy']
po
.
metadata_is_fuzzy
=
[]
# remove [u'fuzzy']
header
=
po
.
header
header
=
po
.
header
fixes
=
(
fixes
=
(
...
@@ -110,31 +111,32 @@ def fix_header(po):
...
@@ -110,31 +111,32 @@ def fix_header(po):
header
=
header
.
replace
(
src
,
dest
)
header
=
header
.
replace
(
src
,
dest
)
po
.
header
=
header
po
.
header
=
header
# By default, django-admin.py makemessages creates this metadata:
"""
{u'PO-Revision-Date': u'YEAR-MO-DA HO:MI+ZONE',
u'Language': u'',
u'Content-Transfer-Encoding': u'8bit',
u'Project-Id-Version': u'PACKAGE VERSION',
u'Report-Msgid-Bugs-To': u'',
u'Last-Translator': u'FULL NAME <EMAIL@ADDRESS>',
u'Language-Team': u'LANGUAGE <LL@li.org>',
u'POT-Creation-Date': u'2013-04-25 14:14-0400',
u'Content-Type': u'text/plain; charset=UTF-8',
u'MIME-Version': u'1.0'}
"""
def
fix_metadata
(
po
):
def
fix_metadata
(
po
):
"""
"""
Replace default metadata with edX metadata
Replace default metadata with edX metadata
"""
"""
fixes
=
{
'PO-Revision-Date'
:
datetime
.
utcnow
(),
'Report-Msgid-Bugs-To'
:
'translation_team@edx.org'
,
# By default, django-admin.py makemessages creates this metadata:
'Project-Id-Version'
:
'0.1a'
,
#
'Language'
:
'en'
,
# {u'PO-Revision-Date': u'YEAR-MO-DA HO:MI+ZONE',
'Last-Translator'
:
''
,
# u'Language': u'',
'Language-Team'
:
'translation team <translation_team@edx.org>'
,
# u'Content-Transfer-Encoding': u'8bit',
}
# u'Project-Id-Version': u'PACKAGE VERSION',
# u'Report-Msgid-Bugs-To': u'',
# u'Last-Translator': u'FULL NAME <EMAIL@ADDRESS>',
# u'Language-Team': u'LANGUAGE <LL@li.org>',
# u'POT-Creation-Date': u'2013-04-25 14:14-0400',
# u'Content-Type': u'text/plain; charset=UTF-8',
# u'MIME-Version': u'1.0'}
fixes
=
{
'PO-Revision-Date'
:
datetime
.
utcnow
(),
'Report-Msgid-Bugs-To'
:
'translation_team@edx.org'
,
'Project-Id-Version'
:
'0.1a'
,
'Language'
:
'en'
,
'Last-Translator'
:
''
,
'Language-Team'
:
'translation team <translation_team@edx.org>'
,
}
po
.
metadata
.
update
(
fixes
)
po
.
metadata
.
update
(
fixes
)
def
strip_key_strings
(
po
):
def
strip_key_strings
(
po
):
...
...
i18n/generate.py
View file @
cab1c04e
...
@@ -16,8 +16,8 @@ languages to generate.
...
@@ -16,8 +16,8 @@ languages to generate.
import
os
,
sys
,
logging
import
os
,
sys
,
logging
from
polib
import
pofile
from
polib
import
pofile
from
config
import
BASE_DIR
,
CONFIGURATION
from
i18n.
config
import
BASE_DIR
,
CONFIGURATION
from
execute
import
execute
from
i18n.
execute
import
execute
LOG
=
logging
.
getLogger
(
__name__
)
LOG
=
logging
.
getLogger
(
__name__
)
...
...
i18n/make_dummy.py
View file @
cab1c04e
...
@@ -24,9 +24,10 @@
...
@@ -24,9 +24,10 @@
import
os
,
sys
import
os
,
sys
import
polib
import
polib
from
dummy
import
Dummy
from
config
import
CONFIGURATION
from
i18n.dummy
import
Dummy
from
execute
import
create_dir_if_necessary
from
i18n.config
import
CONFIGURATION
from
i18n.execute
import
create_dir_if_necessary
def
main
(
file
,
locale
):
def
main
(
file
,
locale
):
...
...
i18n/tests/test_config.py
View file @
cab1c04e
import
os
import
os
from
unittest
import
TestCase
from
unittest
import
TestCase
from
config
import
Configuration
,
LOCALE_DIR
,
CONFIGURATION
from
i18n.
config
import
Configuration
,
LOCALE_DIR
,
CONFIGURATION
class
TestConfiguration
(
TestCase
):
class
TestConfiguration
(
TestCase
):
"""
"""
...
...
i18n/tests/test_converter.py
View file @
cab1c04e
"""Tests of i18n/converter.py"""
"""Tests of i18n/converter.py"""
import
os
from
unittest
import
TestCase
from
unittest
import
TestCase
import
ddt
import
ddt
import
converter
from
i18n
import
converter
class
UpcaseConverter
(
converter
.
Converter
):
class
UpcaseConverter
(
converter
.
Converter
):
"""
"""
...
...
i18n/tests/test_dummy.py
View file @
cab1c04e
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""Tests of i18n/dummy.py"""
"""Tests of i18n/dummy.py"""
import
os
,
string
,
random
from
unittest
import
TestCase
from
unittest
import
TestCase
import
ddt
import
ddt
from
polib
import
POEntry
from
polib
import
POEntry
import
dummy
from
i18n
import
dummy
@ddt.ddt
@ddt.ddt
...
...
i18n/tests/test_extract.py
View file @
cab1c04e
from
datetime
import
datetime
,
timedelta
import
os
import
os
import
polib
from
unittest
import
TestCase
from
unittest
import
TestCase
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
from
datetime
import
datetime
,
timedelta
import
polib
from
pytz
import
UTC
from
pytz
import
UTC
import
extract
from
i18n
import
extract
from
config
import
CONFIGURATION
from
i18n.
config
import
CONFIGURATION
# Make sure setup runs only once
# Make sure setup runs only once
SETUP_HAS_RUN
=
False
SETUP_HAS_RUN
=
False
...
...
i18n/tests/test_generate.py
View file @
cab1c04e
from
datetime
import
datetime
,
timedelta
import
os
import
os
import
string
import
string
import
random
import
random
import
re
import
re
from
polib
import
pofile
from
unittest
import
TestCase
from
unittest
import
TestCase
from
datetime
import
datetime
,
timedelta
from
polib
import
pofile
from
pytz
import
UTC
from
pytz
import
UTC
import
generate
from
i18n
import
generate
from
config
import
CONFIGURATION
from
i18n.
config
import
CONFIGURATION
class
TestGenerate
(
TestCase
):
class
TestGenerate
(
TestCase
):
...
...
i18n/tests/test_validate.py
View file @
cab1c04e
...
@@ -8,9 +8,9 @@ import textwrap
...
@@ -8,9 +8,9 @@ import textwrap
import
polib
import
polib
from
config
import
LOCALE_DIR
from
i18n.
config
import
LOCALE_DIR
from
execute
import
call
from
i18n.
execute
import
call
from
converter
import
Converter
from
i18n.
converter
import
Converter
def
test_po_files
(
root
=
LOCALE_DIR
):
def
test_po_files
(
root
=
LOCALE_DIR
):
...
...
i18n/transifex.py
View file @
cab1c04e
#!/usr/bin/env python
#!/usr/bin/env python
import
os
,
sys
import
sys
from
polib
import
pofile
from
polib
import
pofile
from
config
import
CONFIGURATION
from
extract
import
SOURCE_WARN
from
i18n.config
import
CONFIGURATION
from
execute
import
execute
from
i18n.extract
import
SOURCE_WARN
from
i18n.execute
import
execute
TRANSIFEX_HEADER
=
'Translations in this file have been downloaded from
%
s'
TRANSIFEX_HEADER
=
'Translations in this file have been downloaded from
%
s'
TRANSIFEX_URL
=
'https://www.transifex.com/projects/p/edx-studio/'
TRANSIFEX_URL
=
'https://www.transifex.com/projects/p/edx-studio/'
...
...
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