openhab / openhab-webui

Web UIs of openHAB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Localized entries for "add-on settings"

lolodomo opened this issue · comments

The problem

List of add-ons are not localized in Main UI:

image

Your suggestion

Each add-on has a localized label (and description).
The entries displayed when building this list should provide the localized label.
As an example, I am expecting "Synthèse vocale VoiceRSS" in French rather than "VoiceRss Text-to-Speech".

I guess the API is currently called without providing the expected locale.

As a comparison, the middle column for system settings is properly localized (except the first one - Add-on Management).

image

Might be also an API issue.
When run in dev env (Eclipse), I can see the French translation, that is "Extension Netatmo".
In normal run, the UI displays the untranslated label.

When run inside Eclipse, I can see that the addons REST API returns two entries for the netatmo binding, both with proper label and description translated, one with uid jar:binding-netatmo and one with uid eclipse:binding-netatmo.
image

When run on my RPI, the same API returns only one object with uid binding-netatmo and untranslated label and description.
image

on the RPI, the object is like that:

  {
    "uid": "binding-netatmo",
    "id": "netatmo",
    "label": "Netatmo Binding",
    "version": "4.2.0",
    "compatible": true,
    "contentType": "application/vnd.openhab.feature;type=karaf",
    "link": "https://www.openhab.org/addons/bindings/netatmo/",
    "author": "openHAB",
    "verifiedAuthor": true,
    "installed": true,
    "type": "binding",
    "configDescriptionURI": "binding:netatmo",
    "keywords": "",
    "countries": [],
    "connection": "cloud",
    "properties": {},
    "loggerPackages": [
      "org.openhab.binding.netatmo"
    ]
  },

There is apparently a method isMasterAddonInfo used to return or not the translated label and description:
https://github.com/openhab/openhab-core/blob/918b4faa3b3254a993774147f798e8bc59580bf6/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/KarafAddonService.java#L137

There is also the class AddonInfoAddonsXmlProvider reading the file runtime/etc/addons.xml file and building AddonInfo from this file with masterAddonInfo set to false:
https://github.com/openhab/openhab-core/blob/918b4faa3b3254a993774147f798e8bc59580bf6/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/xml/AddonInfoAddonsXmlProvider.java#L98
The addons.xml file contains label and description in English.

I am not yet understanding the full logic.