From a75ef85ecebaa65333b05bc676ceda9e50d52020 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Mon, 1 Nov 2021 19:32:51 +0100 Subject: [PATCH] [weathercompany] Internationalization of discovery result (#11486) Signed-off-by: Laurent Garnier --- .../internal/discovery/WeatherCompanyDiscoveryService.java | 5 ++--- .../src/main/resources/OH-INF/i18n/weathercompany.properties | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) 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 3dca6e914..e2e9fb4d5 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 @@ -42,7 +42,6 @@ import org.slf4j.LoggerFactory; public class WeatherCompanyDiscoveryService extends AbstractDiscoveryService { // Thing for local weather created during discovery private static final String LOCAL = "local"; - private static final String LOCAL_WEATHER = "Local Forecast"; private static final int DISCOVER_TIMEOUT_SECONDS = 4; private static final int DISCOVERY_INTERVAL_SECONDS = 1200; @@ -119,7 +118,7 @@ public class WeatherCompanyDiscoveryService extends AbstractDiscoveryService { properties.put(CONFIG_LANGUAGE, WeatherCompanyAbstractHandler.lookupLanguage(localeProvider.getLocale())); ThingUID bridgeUID = bridgeHandler.getThing().getUID(); ThingUID localWeatherThing = new ThingUID(THING_TYPE_WEATHER_FORECAST, bridgeUID, LOCAL); - thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withBridge(bridgeUID).withLabel(LOCAL_WEATHER) - .withProperties(properties).build()); + thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withBridge(bridgeUID) + .withLabel("@text/discovery.weather-forecast.local.label").withProperties(properties).build()); } } diff --git a/bundles/org.openhab.binding.weathercompany/src/main/resources/OH-INF/i18n/weathercompany.properties b/bundles/org.openhab.binding.weathercompany/src/main/resources/OH-INF/i18n/weathercompany.properties index 6af3a5140..25017dc49 100644 --- a/bundles/org.openhab.binding.weathercompany/src/main/resources/OH-INF/i18n/weathercompany.properties +++ b/bundles/org.openhab.binding.weathercompany/src/main/resources/OH-INF/i18n/weathercompany.properties @@ -256,3 +256,7 @@ offline.comm-error-timeout = TimeoutException: Call to Weather Company API timed offline.comm-error-parsing-daily-forecast = Error parsing daily forecast offline.comm-error-parsing-daypart-forecast = Error parsing daypart forecast offline.comm-error-parsing-pws-forecast = Error parsing PWS observations + +# discovery result + +discovery.weather-forecast.local.label = Local Forecast