Localization and language#
Just like JupyterLab, JupyterLite provides the ability to set the display language of the user interface.
Language Packs#
To be able to provide a new display language, you will need to install a language pack.
Visit the language packs repository for a list of available packs.
Installing#
JupyterLite follows the same installation procedure as in JupyterLab. Please refer to the JupyterLab documentation to learn more on installing new language packs.
If you already have a JupyterLite deployment, you can add the language packs as dependencies.
For example to add support for French and Simplified Chinese in a requirements.txt
:
jupyterlab-language-pack-fr-FR
jupyterlab-language-pack-zh-CN
Also make sure you have the jupyterlab_server
dependency installed in your build
environment. jupyterlab_server
is used by the jupyter-lite
CLI to find and install
language packs.
You can install it by adding it to your requirements.txt
alongside other dependencies:
jupyterlab-language-pack-fr-FR
jupyterlab-language-pack-zh-CN
jupyterlab_server
Or by installing jupyterlite-core
with translation
extras:
pip install jupyterlite-core[translation]
Then rebuild the website with jupyter lite build
.
Changing the display language#
The steps to change the display language from the user interface are the same as for JupyterLab:
https://jupyterlab.readthedocs.io/en/stable/user/language.html#changing-the-display-language
All of the core JupyterLite apps support localization:
Ignoring language packs from the environment#
It is also possible to ignore the language packs installed in an existing environment to avoid side-effects when deploying the website.
In your jupyter_lite_config.json
file, ignore the translation
addon as follow:
{
"LiteBuildConfig": {
"ignore_sys_prefix": ["translation"]
}
}