diff --git a/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/WeatherCompanyHandlerFactory.java b/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/WeatherCompanyHandlerFactory.java index 220c6d658..8356e0442 100644 --- a/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/WeatherCompanyHandlerFactory.java +++ b/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/WeatherCompanyHandlerFactory.java @@ -29,6 +29,7 @@ import org.openhab.core.config.discovery.DiscoveryService; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.LocationProvider; import org.openhab.core.i18n.TimeZoneProvider; +import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.io.net.http.HttpClientFactory; import org.openhab.core.thing.Bridge; @@ -58,16 +59,19 @@ public class WeatherCompanyHandlerFactory extends BaseThingHandlerFactory { private HttpClient httpClient; private LocationProvider locationProvider; private LocaleProvider localeProvider; + private TranslationProvider i18nProvider; @Activate public WeatherCompanyHandlerFactory(@Reference TimeZoneProvider timeZoneProvider, @Reference UnitProvider unitProvider, @Reference HttpClientFactory httpClientFactory, - @Reference LocationProvider locationProvider, @Reference LocaleProvider localeProvider) { + @Reference LocationProvider locationProvider, @Reference LocaleProvider localeProvider, + @Reference TranslationProvider i18nProvider) { this.timeZoneProvider = timeZoneProvider; this.unitProvider = unitProvider; this.httpClient = httpClientFactory.getCommonHttpClient(); this.locationProvider = locationProvider; this.localeProvider = localeProvider; + this.i18nProvider = i18nProvider; } @Override @@ -103,7 +107,7 @@ public class WeatherCompanyHandlerFactory extends BaseThingHandlerFactory { private synchronized void registerDeviceDiscoveryService(WeatherCompanyBridgeHandler bridgeHandler) { WeatherCompanyDiscoveryService discoveryService = new WeatherCompanyDiscoveryService(bridgeHandler, - locationProvider, localeProvider); + locationProvider, localeProvider, i18nProvider); discoveryService.activate(null); this.discoveryServiceRegs.put(bridgeHandler.getThing().getUID(), bundleContext.registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<>())); diff --git a/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/discovery/WeatherCompanyDiscoveryService.java b/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/discovery/WeatherCompanyDiscoveryService.java index e2e9fb4d5..1dffde948 100644 --- a/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/discovery/WeatherCompanyDiscoveryService.java +++ b/bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/discovery/WeatherCompanyDiscoveryService.java @@ -27,6 +27,7 @@ import org.openhab.core.config.discovery.AbstractDiscoveryService; import org.openhab.core.config.discovery.DiscoveryResultBuilder; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.LocationProvider; +import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.library.types.PointType; import org.openhab.core.thing.ThingUID; import org.slf4j.Logger; @@ -49,7 +50,6 @@ public class WeatherCompanyDiscoveryService extends AbstractDiscoveryService { private final Logger logger = LoggerFactory.getLogger(WeatherCompanyDiscoveryService.class); private final LocationProvider locationProvider; - private final LocaleProvider localeProvider; private final WeatherCompanyBridgeHandler bridgeHandler; private @Nullable ScheduledFuture discoveryJob; @@ -58,11 +58,12 @@ public class WeatherCompanyDiscoveryService extends AbstractDiscoveryService { * Creates a WeatherCompanyDiscoveryService with discovery enabled */ public WeatherCompanyDiscoveryService(WeatherCompanyBridgeHandler bridgeHandler, LocationProvider locationProvider, - LocaleProvider localeProvider) { + LocaleProvider localeProvider, TranslationProvider i18nProvider) { super(SUPPORTED_THING_TYPES_UIDS, DISCOVER_TIMEOUT_SECONDS, true); this.bridgeHandler = bridgeHandler; this.locationProvider = locationProvider; this.localeProvider = localeProvider; + this.i18nProvider = i18nProvider; } @Override