From 3e912eca4b3c80ded53ae2a68fa12f16fe8ed5c1 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sun, 8 Sep 2024 06:13:58 +0200 Subject: [PATCH] Fix translation of label for system:addons service (#4306) The i18n file containing this label is in org.openhab.core bundle. Fix openhab/openhab-webui#1669 Signed-off-by: Laurent Garnier --- .../core/internal/service/ConfigurableServiceResource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java index aca81250439..e9cbdf182e3 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java @@ -54,6 +54,7 @@ import org.openhab.core.io.rest.core.service.ConfigurableServiceDTO; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.service.cm.ConfigurationAdmin; @@ -307,7 +308,11 @@ private List getServicesByFilter(String filter, Locale l String key = I18nUtil.stripConstantOr(defaultLabel, () -> inferKey(configurableService.description_uri(), "label")); - String label = i18nProvider.getText(serviceReference.getBundle(), key, defaultLabel, locale); + // i18n file containing label for system:addons service is exceptionally located in bundle + // org.openhab.core (and not in bundle org.openhab.core.addon.eclipse) + String label = i18nProvider.getText("system:addons".equals(configurableService.description_uri()) + ? FrameworkUtil.getBundle(OpenHAB.class) + : serviceReference.getBundle(), key, defaultLabel, locale); String category = configurableService.category();