Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for localization to the lab extension #3286

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Sep 24, 2021

At the moment the "Save Widget State Automatically" command label is not translated when using JupyterLab in a different display language, in the following case in French:

image

This PR adds an optional ITranslator to the lab plugin to handle this.

We also use a custom jupyterlab_widgets domain since the extension lives outside of the core JupyterLab repo right now.

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch jtpio/ipywidgets/translator

@jtpio
Copy link
Member Author

jtpio commented Sep 24, 2021

This can be backported to 7.x.

@jtpio jtpio added this to the 8.0 milestone Sep 24, 2021
@vidartf
Copy link
Member

vidartf commented Sep 29, 2021

This mostly looks good to me, but to make sure I understand: If a translator wanted to add an entry for this, would they add the entry to the same language pack that JupyterLab uses? How would the versioning of our keys compare to that of JupyterLab? I.e. if we change something, how will we ensure compatibility between an old ipywidgets version and new lab and/or new ipywidgets and old lab?

@jtpio
Copy link
Member Author

jtpio commented Sep 29, 2021

Since jupyterlab_widgets is a regular lab extension, it can follow the same process as other extensions which are currently living in https://github.com/jupyterlab/language-packs

Also this is only for the lab extension and should be independent of the main ipywidgets package.

I've just opened jupyterlab/language-packs#109 to add jupyterlab_widgets to the list.

@krassowski
Copy link

If a translator wanted to add an entry for this, would they add the entry to the same language pack that JupyterLab uses.

Different translation file, the same language pack (may change in the future).

if we change something, how will we ensure compatibility between an old ipywidgets version and new lab and/or new ipywidgets and old lab?

Language packs will retain old translation strings for some time (we didn't decide on how long for extensions, but for JupyterLab as long as old versions are supported). This is tracked in jupyterlab/language-packs#43. I saw @fcollonval implement some of that in jupyterlab/jupyterlab-translate#9 but I think we are not confident that it all works on integration level just yet?

@fcollonval
Copy link
Contributor

but I think we are not confident that it all works on integration level just yet?

Yep for now the merge of source strings is working. But there is no information about the version from which the strings are coming. So there is no easy way to handle the lifecycle of the source strings for extensions in the JupyterLab language packs.

@jasongrout
Copy link
Member

Thanks for answering Vidar's question. Since this seems like the best we can do, I think we ought to go forward. Thanks!

@jasongrout jasongrout merged commit 441135a into jupyter-widgets:master Oct 12, 2021
@jtpio jtpio deleted the translator branch October 12, 2021 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants