]> git.basschouten.com Git - openhab-addons.git/commitdiff
[weathercompany] Internationalization of discovery result (#11486)
authorlolodomo <lg.hc@free.fr>
Mon, 1 Nov 2021 18:32:51 +0000 (19:32 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Nov 2021 18:32:51 +0000 (19:32 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.weathercompany/src/main/java/org/openhab/binding/weathercompany/internal/discovery/WeatherCompanyDiscoveryService.java
bundles/org.openhab.binding.weathercompany/src/main/resources/OH-INF/i18n/weathercompany.properties

index 3dca6e91430f01a726014317e6a398dcd8c40eed..e2e9fb4d5c60d2933894f864c8132e61d8db462a 100644 (file)
@@ -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());
     }
 }
index 6af3a51408be24916f7dafd56e10f81b38febcc0..25017dc49cb777120edb56c6885a5d0c75c706c6 100644 (file)
@@ -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