headlamp-k8s / headlamp

A Kubernetes web UI that is fully-featured, user-friendly and extensible
https://headlamp.dev
Apache License 2.0
2.22k stars 156 forks source link

Enable i18n in plugins #378

Open joaquimrocha opened 2 years ago

joaquimrocha commented 2 years ago

Description

We don't don't bootstrap i18n in plugins, so the responsibility of doing that is left to the plugin developer. So the chances are that plugins will not get i18n.

We cannot of course guarantee that plugins will actually ever get translations to match the languages Headlamp ships by default, but we could encourage the i18n by setting up i18next and its configuration for plugins. So its easy to start contributing translations to any plugin projects.

illume commented 2 years ago

A few bits on this...

Plugins (probably) should use their own namespace?

t('podcounter|Title')

So that there is not an accidental overwriting of other translations (from main Headlamp or from other plugins).

An API to extend existing name spaces?

A plugin could implement an entire language localization potentially.

Additionally, changing copy/text could be done this way. Want to rename Pods to Minions, that should be fairly easy by overriding the translations.

Headlamp could provide translations for plugins?

If a plugin is shipped, and it doesn't supply translations for N locales, it could be that Headlamp could provide them. Potentially allowing reuse of translations and allowing a centralized translation workflow to be used.

We could have some way for people to request localizations.