openscd / open-scd-core

Apache License 2.0
5 stars 8 forks source link

Translate plugin display names #69

Closed ca-d closed 1 year ago

ca-d commented 1 year ago

After introducing translations to our dynamic setting registry API, the very last holdout of untranslated text on users' screens is plugin display names (menu entries for menu type plugins and tab titles for editor type plugins).

In order to translate these as well, we could allow the plugin to set a property on itself that hands us title translations to use dynamically at runtime in an analogous way to the setting registry:

export default class MyPlugin extends HTMLElement {
  constructor() {
    super();
    this.translations = {
      fr: 'Mon Plugin',
      es: 'Mi Complemento',
      nl: 'Mijn Plug-In'
    }
  }
}

Since we cannot technically require a name property with a default English language name to be set on the plugin, the English language fallback name for unavailable translations will be taken directly from the plugin registry file (plugins.json) as has hitherto been the case.

ca-d commented 1 year ago

We've decided in our last refinement session to configure plugin display name translations statically at distribution time in the plugins.json file. This issue will therefore be handled in #17 . Not as nice as sticking with this issue number, but I hope you'll agree that it's best to avoid the confusion of renamed issues with changing topics.