[weathercompany] Fix internationalization of discovery service (#11499)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
05caddab85
commit
554e7574d1
|
@ -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<>()));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue