jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
13.81k stars 3.12k forks source link

The label of toggle sidebar element command should be dynamic #16217

Closed krassowski closed 3 weeks ago

krassowski commented 3 weeks ago

Description

Currently in 4.2.0b3 the application:toggle-sidebar-widget command uses a fixed label which is always "Toggle Sidebar Element". This makes it difficult to identify which which sidebar element will be toggled.

Reproduce

image

Expected behavior

Maybe should show something like: "Toggle 2nd Element in Right Sidebar" instead?

Context

krassowski commented 3 weeks ago

The relevant code is in:

https://github.com/jupyterlab/jupyterlab/blob/2dd8f4ebfdf604f61dd3cc1e4f6da14547e89833/packages/application-extension/src/index.tsx#L373-L379

The label can be a function taking args the same way as execute does.

The strings will need to be created using the translation formatting as documented in https://jupyterlab.readthedocs.io/en/stable/extension/internationalization.html#internationalization-and-localization