Skip to content

Commit

Permalink
Fix translation of label for system:addons service (#4306)
Browse files Browse the repository at this point in the history
The i18n file containing this label is in org.openhab.core bundle.

Fix openhab/openhab-webui#1669

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored Sep 8, 2024
1 parent edf5b62 commit 3e912ec
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -307,7 +308,11 @@ private List<ConfigurableServiceDTO> 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();

Expand Down

0 comments on commit 3e912ec

Please sign in to comment.