Skip to content

Commit a14a61d

Browse files
authored
[POC] feat: add course translations plugin (#650)
* [POC] feat: add course translations plugin * rename dir * fmt * disable pre-commit errors for now * disable pre-commit errors for now * refactor * fix translated archive name * pre-commit * more pre-commit fixes * more pre-commit fixes * more pre-commit fixes * more pre-commit fixes * update readme * create tar.gz instead of zip and remove the extracted and translated directories * use same directory to create translated course * review changes * review changes * review changes * fmt * review changes
1 parent 184e872 commit a14a61d

File tree

13 files changed

+821
-1
lines changed

13 files changed

+821
-1
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ edx-extensions/
2020
│ ├── ol_openedx_chat/ # Chat integration
2121
│ ├── ol_openedx_chat_xblock/ # Chat XBlock
2222
│ ├── ol_openedx_course_sync/ # Course synchronization
23+
│ ├── ol_openedx_course_translations/ # Course translations
2324
│ ├── ol_openedx_git_auto_export/ # Git export automation
2425
│ ├── ol_openedx_logging/ # Logging enhancements
2526
│ ├── ol_openedx_otel_monitoring/ # OpenTelemetry monitoring

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ exclude =
2727
__pycache__
2828

2929
[mypy]
30-
python_version=3.8
30+
python_version=3.11
3131
ignore_missing_imports=True
3232

3333
[darglint]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Change Log
2+
----------
3+
4+
..
5+
All enhancements and patches to ol_openedx_chat will be documented
6+
in this file. It adheres to the structure of https://keepachangelog.com/ ,
7+
but in reStructuredText instead of Markdown (for ease of incorporation into
8+
Sphinx documentation and the PyPI description).
9+
10+
This project adheres to Semantic Versioning (https://semver.org/).
11+
.. There should always be an "Unreleased" section for changes pending release.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright (C) 2022 MIT Open Learning
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
OL Open edX Course Translations
2+
###############
3+
4+
An Open edX plugin to manage course translations.
5+
6+
Purpose
7+
*******
8+
9+
Translate course content into multiple languages to enhance accessibility for a global audience.
10+
11+
Setup
12+
=====
13+
14+
For detailed installation instructions, please refer to the `plugin installation guide <../../docs#installation-guide>`_.
15+
16+
Installation required in:
17+
18+
* Studio (CMS)
19+
20+
Configuration
21+
=============
22+
23+
1. edx-platform configuration
24+
-----------------------------
25+
26+
- Add the following configuration values to the config file in Open edX. For any release after Juniper, that config file is ``/edx/etc/lms.yml``. If you're using ``private.py``, add these values to ``lms/envs/private.py``. These should be added to the top level. **Ask a fellow developer for these values.**
27+
28+
.. code-block:: python
29+
30+
DEEPL_API_KEY: <YOUR_DEEPL_API_KEY_HERE>
31+
32+
- For Tutor installations, these values can also be managed through a `custom Tutor plugin <https://docs.tutor.edly.io/tutorials/plugin.html#plugin-development-tutorial>`_.
33+
34+
Usage
35+
====================
36+
1. Open the course in Studio.
37+
2. Go to Tools -> Export Course.
38+
3. Export the course as a .tar.gz file.
39+
4. Go to the CMS shell
40+
5. Run the management command to translate the course:
41+
42+
.. code-block:: bash
43+
44+
./manage.py cms translate_course --source-language <SOURCE_LANGUAGE_CODE, defaults to `EN`> --translation-language <TRANSLATION_LANGUAGE_CODE i.e. AR> --course-dir <PATH_TO_EXPORTED_COURSE_TAR_GZ>
45+
46+
License
47+
*******
48+
49+
The code in this repository is licensed under the AGPL 3.0 unless
50+
otherwise noted.
51+
52+
Please see `LICENSE.txt <LICENSE.txt>`_ for details.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
MIT's Open edX course translations plugin
3+
"""
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
ol_openedx_course_translations Django application initialization.
3+
"""
4+
5+
from django.apps import AppConfig
6+
from edx_django_utils.plugins import PluginSettings
7+
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
8+
9+
10+
class OLOpenedXCourseTranslationsConfig(AppConfig):
11+
"""
12+
Configuration for the ol_openedx_course_translations Django application.
13+
"""
14+
15+
name = "ol_openedx_course_translations"
16+
17+
plugin_app = {
18+
PluginSettings.CONFIG: {
19+
ProjectType.CMS: {
20+
SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: "settings.common"},
21+
},
22+
},
23+
}

src/ol_openedx_course_translations/ol_openedx_course_translations/management/__init__.py

Whitespace-only changes.

src/ol_openedx_course_translations/ol_openedx_course_translations/management/commands/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)