Open emiliom opened 1 year ago
To set a specific language as the JupyterLab default, first the language pack package must be installed in the conda environment. The ES language pack is available on conda-forge as jupyterlab-language-pack-es-ES
.
Then, we create an overrides.json
file and place it in the path <sys.prefix>/settings/
, where <sys.prefix>
is the Application Directory, which can be obtain with the command jupyter lab path
(assuming the conda environment includes JupyterLab). For example, on my Ubuntu computer this settings path is ~/miniconda3/envs/jupyterlab_new/share/jupyter/lab/settings/
If the user changes the language through JupyterLab interface, overrides.json
will no longer be used.
Here's what the content of overrides.json
should be:
{
"@jupyterlab/translation-extension:plugin": {
"locale": "es_ES"
}
}
For more information:
@abkfenris do you have any input on this? We'll add the language pack package ourselves, right? While doing that, should we also address #2? As for placing the overrides.json
file in the right path, I imagine that'll be for 2i2c, right?
Hmm, exploring those a bit I think /opt/conda/share/jupyter/lab/settings/overrides.json
would be the path. That's one that we can set because it's baked into the image (so it could be COPY overrides.json /opt/conda/share/jupyter/lab/settings/overrides.json
).
If it's in the other paths its going to be more complicated to tweak because each user gets /home/jovyan/
mounted to a separate filesystem.
(base) jovyan@jupyter-abkfenris:~$ jupyter lab path
[LabPathApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `LabPathApp`.
Application directory: /opt/conda/share/jupyter/lab
User Settings directory: /home/jovyan/.jupyter/lab/user-settings
Workspaces directory: /home/jovyan/.jupyter/lab/workspaces
Added comments on #2 about bumping other packages/underlying image.
Thanks! Heh, it didn't occur to me to follow my own instructions and run jupyter lab path
on the hub.
I'm pretty sure it's not the "Workspaces directory", but I don't know if it'd be "User Settings directory". It looks like it really is "Application directory", /opt/conda/share/jupyter/lab
:crossed_fingers:
I can communicate this to 2i2c. Worse case scenario, each user will have to switch the language via the interface, and I already have instruction in Spanish for doing that, with screenshots and all.
Also add the Brazilian Portuguese language pack to the Python image, while we're at it! See https://github.com/2i2c-org/default-hub-homepage/pull/20#pullrequestreview-1294758679
I think I'm now pedaling back from changing the language default, and instead stick with the English default plus instructions for switching the language. We already have the instructions in Spanish for switching the language to Spanish.
That'll be less work overall and less experimentation at this stage, plus less disruption to others outside this event. Plus, most participants in this Spanish event will already have seen, and possibly even applied, the instructions for switching language; and there may be some advantage in event participants being clearly aware that the English interface is readily accessible.
With the hub now using the updated Python image, I've confirmed that the Spanish and Portuguese language packs are now accessible on JupyterLab, and switching to the Spanish language pack works as expected.
jupyterlab-language-pack-es-ES
to the Python image