diff --git a/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelHandlerFactory.java b/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelHandlerFactory.java index 376f9dad181d9..bbf72a4a107fe 100644 --- a/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelHandlerFactory.java +++ b/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelHandlerFactory.java @@ -22,8 +22,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.rotel.internal.handler.RotelHandler; -import org.openhab.core.i18n.LocaleProvider; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.io.transport.serial.SerialPortManager; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; @@ -57,17 +55,12 @@ public class RotelHandlerFactory extends BaseThingHandlerFactory { private final SerialPortManager serialPortManager; private final RotelStateDescriptionOptionProvider stateDescriptionProvider; - private final TranslationProvider i18nProvider; - private final LocaleProvider localeProvider; @Activate public RotelHandlerFactory(final @Reference SerialPortManager serialPortManager, - final @Reference RotelStateDescriptionOptionProvider stateDescriptionProvider, - final @Reference TranslationProvider i18nProvider, final @Reference LocaleProvider localeProvider) { + final @Reference RotelStateDescriptionOptionProvider stateDescriptionProvider) { this.serialPortManager = serialPortManager; this.stateDescriptionProvider = stateDescriptionProvider; - this.i18nProvider = i18nProvider; - this.localeProvider = localeProvider; } @Override @@ -80,7 +73,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { - return new RotelHandler(thing, stateDescriptionProvider, serialPortManager, i18nProvider, localeProvider); + return new RotelHandler(thing, stateDescriptionProvider, serialPortManager); } return null; diff --git a/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java b/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java index b28a7843fae6b..dee9a28ed4477 100644 --- a/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java +++ b/bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java @@ -41,8 +41,6 @@ import org.openhab.binding.rotel.internal.communication.RotelSimuConnector; import org.openhab.binding.rotel.internal.communication.RotelSource; import org.openhab.binding.rotel.internal.configuration.RotelThingConfiguration; -import org.openhab.core.i18n.LocaleProvider; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.io.transport.serial.SerialPortManager; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.IncreaseDecreaseType; @@ -61,8 +59,6 @@ import org.openhab.core.types.State; import org.openhab.core.types.StateOption; import org.openhab.core.types.UnDefType; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -89,9 +85,6 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL private RotelStateDescriptionOptionProvider stateDescriptionProvider; private SerialPortManager serialPortManager; - private TranslationProvider i18nProvider; - private LocaleProvider localeProvider; - private Bundle bundle; private RotelConnector connector = new RotelSimuConnector(DEFAULT_MODEL, RotelProtocol.HEX, new HashMap<>(), "OH-binding-rotel"); @@ -139,13 +132,10 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL * Constructor */ public RotelHandler(Thing thing, RotelStateDescriptionOptionProvider stateDescriptionProvider, - SerialPortManager serialPortManager, TranslationProvider i18nProvider, LocaleProvider localeProvider) { + SerialPortManager serialPortManager) { super(thing); this.stateDescriptionProvider = stateDescriptionProvider; this.serialPortManager = serialPortManager; - this.i18nProvider = i18nProvider; - this.localeProvider = localeProvider; - this.bundle = FrameworkUtil.getBundle(this.getClass()).getBundleContext().getBundle(); } @Override @@ -455,12 +445,7 @@ public List getStateOptions(List list, Map options = new ArrayList<>(); for (RotelSource item : list) { String label = sourcesLabels.get(item); - String key = "source." + item.getName(); - String label2 = i18nProvider.getText(bundle, key, key, localeProvider.getLocale()); - if (label2 == null || label2.isEmpty()) { - label2 = key; - } - options.add(new StateOption(item.getName(), label == null ? label2 : label)); + options.add(new StateOption(item.getName(), label == null ? ("@text/source." + item.getName()) : label)); } return options; }