openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
218 stars 239 forks source link

[MainUI] Translated binding name ignored in the bindings page #1213

Closed lolodomo closed 2 months ago

lolodomo commented 2 years ago

I would expect the display of "Extension Astro" rather than "Astro Binding" for example in the bindings/marketplace page because "Extension Astro" is the French translation for this binding name.

image

clinique commented 2 years ago

Isn't this because it's based on factures.xml file instead of binding.xml ?

lolodomo commented 2 years ago

Why is it tagged as invalid? My screen capture is clear, no? If translation was working, I should see "Extension Astro".

wborn commented 2 years ago

It's more an OHC issue because the REST API currently cannot return localized add-on names. The reason is that all the localization strings in bundles are unavailable until you install the bundle using the feature. :wink: When this is solved in OHC, it should probably work without any changes in the UI.

ghys commented 2 years ago

Yes, the tag is how I move issues that have clearly nothing to do with the UI itself out of my main filter...

More generally a lot of inconsistencies may also have to do with the browser configuration, since the API tends to consider that the Accept-Language header trumps the org.openhab.i18n service configuration.

If you have the browser configured like this

image

Then you'd have many API responses in English even if openHAB is configured in French, because requests have a: Accept-Language: en-US,en;q=0.9,de;q=0.8,fr-FR;q=0.7,fr;q=0.6 header sent by the browser.

I think I mentioned it before, but I think the Accept-Language header should be ignored if a language is set server-wide, if not at all (become some other things will not consider it anyways, and rely on the server config only; for instance, the login/authorize/change password screens).

lolodomo commented 2 years ago

Ok. But in the current case, the bindings are already installed.

wborn commented 2 years ago

It would be a confusing UX when add-on names change whenever you (un)install add-ons. :upside_down_face:

lolodomo commented 2 years ago

I can just confirm that my browser (Firefox) is setup for French: image

I also tried with Chrome and Edge and same result.

ghys commented 2 years ago

It's actually the settings for pages not menus that is important

image

image

image

image

The add-on store (and the /rest/addons endpoint) is different and doesn't offer translations in any case.

lolodomo commented 2 years ago

In Firefox, I see only one place to setup the language.

Note that in another MainUI place (adding new thing), I see correct translations: image

This is apparently only in the "bindings" page that I have no translation, certainly for the reason you explained (not supported by the core REST API).

lolodomo commented 2 years ago

If I use the API Explorer, I got this with the addons API, that is no translation: image

Same result if I add "fr-FR" as accept-language header.

Also note that the description is empty.

wborn commented 2 years ago

That UI page probably uses the /rest/bindings endpoint.

lolodomo commented 2 years ago

I do not remember if this is was correctly translated before the marketplace stuff was added.

lolodomo commented 2 years ago

That UI page probably uses the /rest/bindings endpoint.

Oh yes, the bindings REST API is working well, you're right. So that means it is possible to return translated label/description in the addons API too ?

wborn commented 2 years ago

Yes but the main issue still is that the /addons endpoint is based on Karaf features and you cannot access translations of bundles that haven't been installed.

So it would help if the add-on/feature metadata (https://github.com/openhab/openhab-core/issues/2058) is aggregated and is available without having to install all add-ons. :slightly_smiling_face:

lolodomo commented 2 years ago

Yes but the main issue still is that the /addons endpoint is based on Karaf features and you cannot access translations of bundles that haven't been installed.

But for the ones that are already installed ?

wborn commented 2 years ago

Then I agree with @wborn in https://github.com/openhab/openhab-webui/issues/1213#issuecomment-997230256

It would be a confusing UX when add-on names change whenever you (un)install add-ons. :upside_down_face:

ghys commented 2 years ago

Then I agree with @wborn in #1213 (comment)

That is reassuring 🤣

lolodomo commented 2 months ago

Closed as (partially) resolved.