Extract the context_translation plugin into python_packages
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Extract the in-context translation plugin from kolibri/plugins/context_translation into its own package under python_packages/. It is an internal, translation-workflow-only plugin that need not ship in the Kolibri package. The extraction is bootstrapped with kolibri plugin create (its first real use), then the existing code is moved across.
Complexity: Low Target branch: develop
Context
- The in-tree plugin
ContextTranslationPluginsetskolibri_option_defaults—LANGUAGES=ach-ugplus Crowdin/Google-fontsCSP_HOST_SOURCES. - It sets
django_settingsthat patchdjango.conf.locale.LANG_INFOto add theach-ugin-context pseudo-language. - Its
JIPTHeadHook(FrontEndBaseHeadHook)injects a staticjipt.jsplus Crowdin's CDNjipt.jsinto<head>. - Files:
kolibri_plugin.py,option_defaults.py,settings.py,static/assets/context_translation/jipt.js(with stale committed.gz/.file_sizeartifacts). - No webpack build → the closest
kolibri plugin createsurface is backend-only; the head hook, static asset, settings, and option defaults are moved across, not generated.
The Change
- Scaffold
python_packages/kolibri-context-translation-plugin/withkolibri plugin create(backend-only surface), then move the plugin's code across. - Carry
JIPTHeadHook,option_defaults.py, andsettings.pyacross unchanged. - Commit
jipt.jsas source. - Add a package
buildscript that runskolibri-build compressover the plugin'sstatic/, generating.gz/.file_sizeat build time (matching Kolibri core). - Gitignore the compressed outputs.
- Drop the stale committed
.gz/.file_size. - Declare the
kolibri.pluginsentry point in the package'spyproject.toml;include-package-dataships the compressed static asset. - Remove
kolibri/plugins/context_translation/and its entry in the rootpyproject.toml.
Acceptance Criteria
General
- [ ]
python_packages/kolibri-context-translation-plugin/exists as a uv workspace member with its ownpyproject.tomldeclaring thekolibri.pluginsentry point. - [ ] A package
buildscript runskolibri-build compressover the plugin'sstatic/;jipt.jsis committed source, and.gz/.file_sizeare generated at build time, not committed. - [ ]
kolibri/plugins/context_translation/and its rootpyproject.tomlentry-point line are removed. - [ ] Enabling the package injects the JIPT
<head>scripts; disabling removes them. - [ ] Enabling the package registers the
ach-ugpseudo-language; disabling reverts it. - [ ] Enabling the package applies the
LANGUAGES/CSP_HOST_SOURCESoption defaults; disabling reverts them.
Testing
- [ ] Building the package's wheel (frontend build + compress) and enabling it in a Kolibri install exposes the plugin as discoverable/enable-able and serves the compressed
jipt.js.
References
- In-tree plugin being extracted:
kolibri/plugins/context_translation - Package-layout exemplar (backend + settings/options + static):
python_packages/kolibri-oidc-client-plugin
AI usage
Drafted with Claude Code, which read the in-tree plugin and the build/publish tooling; I drove every scope decision. I verified the surface mapping and static-asset handling against the migrated exemplar packages before creating the issue.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.