- Open issues, bug reports and send PRs on github.
- Make sure it's
py3.6+
compatible. - Docker (which engine must run in the background).
- Use black code formatting.
pre-commit
must be activated before (code must pass all pre-commit checks to succeed in the CI)
We use ogv.js
, to play webm videos on browsers that don't support it. Using video.js
, we default to native playback if supported.
ogv.js
is an emscripten-based JS decoder for webm and thus dynamically loads differents parts at run-time on platforms that needs them. It has two consequences:
kolibri2zim
has very minimal non-content text but still uses gettext through babel to internationalize.
To add a new locale (fr
in this example, use only ISO-639-1):
- init for your locale:
pybabel init -d locale -l fr
- make sure the POT is up to date
pybabel extract -o kolibri2zim/locale/messages.pot kolibri2zim
- update your locale's catalog
pybabel update -d kolibri2zim/locale/ -l fr -i kolibri2zim/locale/messages.pot
- translate the PO file (poedit is your friend)
- compile updated translation
pybabel compile -d kolibri2zim/locale -l fr
Sometimes you need to alter something in the ZIM UI in Vue.JS but for this to work, you need assets which are generated by the scraper (e.g. channel.json, ...).
To simplify this, it is possible to:
- run the scraper (with original code base or your modified one)
- extract assets from generated files and place them in a directory where ZIM UI will find them
- iterate on ZIM UI code
To achieve this, first build the Docker image based on current code base.
docker build -t local-kolibri2zim .
Scrape a channel (here we use the minimal channel, but you could use any other one of interest for your UI developments).
docker run --rm -it -v "$PWD/output":/output local-kolibri2zim kolibri2zim --name "minimal_test" --title "Minimal Kolibri Channel Test" --description "This is a minimal K
olibri Channel, with new Kolibri UI" --channel-id "7f744ce8d28b471eaf663abd60c92267" --zim-file "Minimal_Test.zim"
Extract interesting ZIM content and move it to public
folder.
find zimui/public/ -mindepth 1 -maxdepth 1 ! -name ".gitignore" -delete
docker run -it --rm -v $(pwd)/output:/data ghcr.io/openzim/zim-tools:latest zimdump dump --dir=/data/Minimal_Test /data/Minimal_Test.zim
sudo chown -R $(id -u -n):$(id -g -n) output/Minimal_Test
mv output/Minimal_Test/* zimui/public/
rm -rf output/Minimal_Test
Start ZIM UI locally.
cd zimui
yarn dev
Do not forget to cleanup public
folder before building the docker image again, otherwise all assets will be pushed to the ZIM.