Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
OpenEdx
xblock-drag-and-drop-v2
Commits
e07ced87
Commit
e07ced87
authored
Aug 05, 2016
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
README sections about localization
parent
2afee49e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
README.md
+78
-0
No files found.
README.md
View file @
e07ced87
...
...
@@ -429,3 +429,80 @@ Similarly, you can run the integration test suite via
```
bash
$
python run_tests.py tests/integration/
```
i18n compatibility
==================
According to
[
edX docs on XBlock i18n
][
edx-docs-i18n
]
, LMS runtime is capable of supporting XBlock i18n and l10n.
To comply with l10n requirements, XBlock is supposed to provide translations in
`xblock_package_root/translations/locale_code/LC_MESSAGES/text.po`
folder in GNU Gettext Portable Object file format.
[
edx-docs-i18n
]:
http://edx.readthedocs.io/projects/xblock-tutorial/en/latest/edx_platform/edx_lms.html#internationalization-support
Drag and Drop v2 XBlock aims to comply with i18n requirements for Open edX platform, including a stricter set of
requirements for
`edx.org`
itself, thus providing the required files. So far only two translations are available:
*
Default English translation
*
Fake "Esperanto" translation used to test i18n/l10n.
Updates to translated strings are supposed to be propagated to
`text.po`
files. Unfortunately, the process is mostly
manual. EdX
[
i18n_tools
][
edx-i18n-tools
]
might be helpful, but they are too tied to edx-platform, so as of Aug 2016
do not provide any benefits over manual approach.
[
edx-i18n-tools
]:
https://github.com/edx/i18n-tools
In lieu of automated solution (i.e. edX i18n-tools supporting XBlock use case), one can use GNU Gettext toolkit
to simplify manual updating
`text.po`
files.
This command scrapes all the strings in all
`*.py`
files in
`drag_and_drop_v2`
folder and outputs
`messages.po`
file
in
`drag_and_drop_v2`
folder:
```
~/xblock-drag-and-drop-v2/drag_and_drop_v2$ find . -name "*.py" | xargs xgettext --language=python
```
Javascript command is a little bit more verbose:
```
~/xblock-drag-and-drop-v2/drag_and_drop_v2$ find . -name "*.js" -o -path ./public/js/vendor -prune -a -type f | xargs xgettext --language=javascript --from-code=utf-8
```
Note that both commands generate partial
`messages.po`
file - JS or python only, while
`test.po`
is supposed to contain
all translatable strings. Both commands can be modified to append to
*exsisting*
`messages.po`
file by adding
`--join-existing`
key.
To check if
`text.po`
is correct, one can run
`msgfmt`
to build a
`text.mo`
file:
```
~/xblock-drag-and-drop-v2/drag_and_drop_v2$ msgfmt translations/en/LC_MESSAGES/text.po -o translations/en/LC_MESSAGES/text.mo
```
If everything is correct, it will silently exit and create
`translations/en/LC_MESSAGES/text.mo`
file.
**Note:**
As of 2016-08-04, XBlock translation feature was (partially?) broken, so switching to other locale did not
cause Drag and Drop v2 to be fully translated - only some strings that happen to exist in edx-platform translation
files are translated. There's an ongoing effort to fix this problem: https://openedx.atlassian.net/browse/WL-230.
Building fake "Esperanto" translation
-------------------------------------
As previously said, this fake translation mainly exists for testing reasons. For edX platform it is built using Dummy
translator from edX i18n-tools. Luckily, it is possible to use "translation" generation feature without the rest of
i18n-tools.
To do so, in any virtualenv, install i18n-tools, i.e.
(virtualenv)$ pip install -e git+https://github.com/edx/i18n-tools.git
Then start python interpreter, import
`Dummy`
translator and follow instructions on
`Dummy`
docstring:
(virtualenv)$ python
>>> from i18n.dummy import Dummy
>>> help(Dummy)
# or just do
>>> conv = Dummy()
>>> print conv.convert("String to translate")
Then copy output and paste it into
`translations/eo/LC_MESSAGES/text.po`
.
\ No newline at end of file
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