]> git.basschouten.com Git - openhab-addons.git/commitdiff
[smhi] Prepare for easier translation (#13305)
authorAnders Alfredsson <30875102+pacive@users.noreply.github.com>
Mon, 22 Aug 2022 08:47:44 +0000 (10:47 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Aug 2022 08:47:44 +0000 (10:47 +0200)
Signed-off-by: Anders Alfredsson <andersb86@gmail.com>
bundles/org.openhab.binding.smhi/README.md
bundles/org.openhab.binding.smhi/src/main/java/org/openhab/binding/smhi/internal/SmhiHandler.java
bundles/org.openhab.binding.smhi/src/main/resources/OH-INF/config/forecast-config.xml
bundles/org.openhab.binding.smhi/src/main/resources/OH-INF/i18n/smhi.properties

index 88184356604c00d5669ea70c6034d87447f4056c..64771eee95556af4a8aed7aac896a4aa7e5885dc 100644 (file)
@@ -18,12 +18,12 @@ This binding does not support automatic discovery.
 The forecast thing needs to be configured with the latitude and longitude for the location of the forecast. 
 You can also choose for which hours and which days you would like to get forecasts.
 
-| Parameter | Description | Required |
-|-----------|-------------|----------|
-| Latitude  | Latitude of the forecast | Yes |
-| Longitute | Longitude of the forecast | Yes |
-| Hourly forecasts | The hourly forecasts to display | No |
-| Daily forecasts | The daily forecasts to display | No |
+| Parameter        | Description                     | Required |
+|------------------|---------------------------------|----------|
+| Latitude         | Latitude of the forecast        | Yes      |
+| Longitude        | Longitude of the forecast       | Yes      |
+| Hourly forecasts | The hourly forecasts to display | No       |
+| Daily forecasts  | The daily forecasts to display  | No       |
 
 ## Channels
 
@@ -40,81 +40,81 @@ Examples:
 
 #### Basic channels
 
-| channel  | type   | channel id | description                  |
-|----------|--------|------------|------------------------------|
-| Temperature  | Number:Temperature | t | Temperature in Celsius  |
-| Max Temperature  | Number:Temperature | tmax | Highest temperature of the day (daily forecast only)  |
-| Min Temperature  | Number:Temperature | tmin | Lowest temperature of the day (daily forecast only)  |
-| Wind direction  | Number:Angle | wd | Wind direction in degrees  |
-| Wind Speed  | Number:Speed | ws | Wind speed in m/s  |
-| Max Wind Speed  | Number:Speed | wsmax | Highest wind speed of the day (daily forecast only)  |
-| Min Wind Speed  | Number:Speed | wsmin | Lowest wind speed of the day (daily forecast only)  |
-| Wind gust speed  | Number:Speed | gust | Wind gust speed in m/s  |
-| Minimum precipitation  | Number:Speed | pmin | Minimum precipitation intensity in mm/h  |
-| Maximum precipitation  | Number:Speed | pmax | Maximum precipitation intensity in mm/h  |
-| Total precipitation  | Number:Length | ptotal | Total amount of precipitation during the day, in mm (daily forecast only)  |
-| Precipitation category*  | Number | pcat | Type of precipitation  |
-| Air pressure  | Number:Pressure | msl | Air pressure in hPa  |
-| Relative humidity  | Number:Dimensionless | r | Relative humidity in percent  |
-| Total cloud cover  | Number:Dimensionless | tcc_mean | Mean value of total cloud cover in percent  |
-| Weather condition**  | Number | wsymb2 | Short description of the weather conditions  |
+| channel                 | type                 | channel id | description                                                               |
+|-------------------------|----------------------|------------|---------------------------------------------------------------------------|
+| Temperature             | Number:Temperature   | t          | Temperature in Celsius                                                    |
+| Max Temperature         | Number:Temperature   | tmax       | Highest temperature of the day (daily forecast only)                      |
+| Min Temperature         | Number:Temperature   | tmin       | Lowest temperature of the day (daily forecast only)                       |
+| Wind direction          | Number:Angle         | wd         | Wind direction in degrees                                                 |
+| Wind Speed              | Number:Speed         | ws         | Wind speed in m/s                                                         |
+| Max Wind Speed          | Number:Speed         | wsmax      | Highest wind speed of the day (daily forecast only)                       |
+| Min Wind Speed          | Number:Speed         | wsmin      | Lowest wind speed of the day (daily forecast only)                        |
+| Wind gust speed         | Number:Speed         | gust       | Wind gust speed in m/s                                                    |
+| Minimum precipitation   | Number:Speed         | pmin       | Minimum precipitation intensity in mm/h                                   |
+| Maximum precipitation   | Number:Speed         | pmax       | Maximum precipitation intensity in mm/h                                   |
+| Total precipitation     | Number:Length        | ptotal     | Total amount of precipitation during the day, in mm (daily forecast only) |
+| Precipitation category* | Number               | pcat       | Type of precipitation                                                     |
+| Air pressure            | Number:Pressure      | msl        | Air pressure in hPa                                                       |
+| Relative humidity       | Number:Dimensionless | r          | Relative humidity in percent                                              |
+| Total cloud cover       | Number:Dimensionless | tcc_mean   | Mean value of total cloud cover in percent                                |
+| Weather condition**     | Number               | wsymb2     | Short description of the weather conditions                               |
 
 #### Advanced channels
 
-| channel  | type   | channel id | description                  |
-|----------|--------|------------|------------------------------|
-| Visibility  | Number:Length | vis | Horizontal visibility in km  |
-| Thunder probability  | Number:Dimensionless | tstm | Probability of thunder in percent  |
-| Frozen precipitation  | Number:Dimensionless | spp | Percent of precipitation in frozen form (will be set to UNDEF if there's no precipitation)  |
-| Low level cloud cover  | Number:Dimensionless | lcc_mean | Mean value of low level cloud cover (0-2500 m) in percent  |
-| Medium level cloud cover  | Number:Dimensionless | mcc_mean | Mean value of medium level cloud cover (2500-6000 m) in percent  |
-| High level cloud cover  | Number:Dimensionless | hcc_mean | Mean value of high level cloud cover (> 6000 m) in percent  |
-| Mean precipitation  | Number:Speed | pmean | Mean precipitation intensity in mm/h  |
-| Median precipitation  | Number:Speed | pmedian | Median precipitation intensity in mm/h  |
-
-\* The precipitation category can have a value from 0-6, representing different types of precipitaion:
-
-| Value | Meaning |
-|-------|---------|
-| 0 | No precipitation|
-| 1 | Snow |
-| 2 | Snow and rain |
-| 3 | Rain |
-| 4 | Drizzle |
-| 5 | Freezing rain |
-| 6 | Freezing drizzle |
+| channel                  | type                 | channel id | description                                                                                |
+|--------------------------|----------------------|------------|--------------------------------------------------------------------------------------------|
+| Visibility               | Number:Length        | vis        | Horizontal visibility in km                                                                |
+| Thunder probability      | Number:Dimensionless | tstm       | Probability of thunder in percent                                                          |
+| Frozen precipitation     | Number:Dimensionless | spp        | Percent of precipitation in frozen form (will be set to UNDEF if there's no precipitation) |
+| Low level cloud cover    | Number:Dimensionless | lcc_mean   | Mean value of low level cloud cover (0-2500 m) in percent                                  |
+| Medium level cloud cover | Number:Dimensionless | mcc_mean   | Mean value of medium level cloud cover (2500-6000 m) in percent                            |
+| High level cloud cover   | Number:Dimensionless | hcc_mean   | Mean value of high level cloud cover (> 6000 m) in percent                                 |
+| Mean precipitation       | Number:Speed         | pmean      | Mean precipitation intensity in mm/h                                                       |
+| Median precipitation     | Number:Speed         | pmedian    | Median precipitation intensity in mm/h                                                     |
+
+\* The precipitation category can have a value from 0-6, representing different types of precipitation:
+
+| Value | Meaning          |
+|-------|------------------|
+| 0     | No precipitation |
+| 1     | Snow             |
+| 2     | Snow and rain    |
+| 3     | Rain             |
+| 4     | Drizzle          |
+| 5     | Freezing rain    |
+| 6     | Freezing drizzle |
 
 \** The weather condition channel can take values from 1-27, each corresponding to a different weather condition:
 
-| Value | Condition |
-|-------|-----------|
-| 1 | Clear sky |
-| 2 | Nearly clear sky |
-| 3 | Variable cloudiness |
-| 4 | Halfclear sky |
-| 5 | Cloudy sky |
-| 6 | Overcast |
-| 7 | Fog |
-| 8 | Light rain showers |
-| 9 | Moderate rain showers |
-| 10 | Heavy rain showers |
-| 11 | Thunderstorm |
-| 12 | Light sleet showers |
-| 13 | Moderate sleet showers |
-| 14 | Heavy sleet showers |
-| 15 | Light snow showers |
-| 16 | Moderate snow showers |
-| 17 | Heavy snow showers |
-| 18 | Light rain |
-| 19 | Moderate rain |
-| 20 | Heavy rain |
-| 21 | Thunder |
-| 22 | Light sleet |
-| 23 | Moderate sleet |
-| 24 | Heavy sleet |
-| 25 | Light snowfall |
-| 26 | Moderate snowfall |
-| 27 | Heavy snowfall |
+| Value | Condition              |
+|-------|------------------------|
+| 1     | Clear sky              |
+| 2     | Nearly clear sky       |
+| 3     | Variable cloudiness    |
+| 4     | Half clear sky         |
+| 5     | Cloudy sky             |
+| 6     | Overcast               |
+| 7     | Fog                    |
+| 8     | Light rain showers     |
+| 9     | Moderate rain showers  |
+| 10    | Heavy rain showers     |
+| 11    | Thunderstorm           |
+| 12    | Light sleet showers    |
+| 13    | Moderate sleet showers |
+| 14    | Heavy sleet showers    |
+| 15    | Light snow showers     |
+| 16    | Moderate snow showers  |
+| 17    | Heavy snow showers     |
+| 18    | Light rain             |
+| 19    | Moderate rain          |
+| 20    | Heavy rain             |
+| 21    | Thunder                |
+| 22    | Light sleet            |
+| 23    | Moderate sleet         |
+| 24    | Heavy sleet            |
+| 25    | Light snowfall         |
+| 26    | Moderate snowfall      |
+| 27    | Heavy snowfall         |
 
 
 ## Full Example
index 2b494a63a5f59246d8a16aa21380321db9b64744..7189012ff475f16e7529be5cdf7424fb905e4334 100644 (file)
@@ -317,7 +317,7 @@ public class SmhiHandler extends BaseThingHandler {
                 return;
             } catch (PointOutOfBoundsException e) {
                 updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
-                        "Coordinates outside valid area");
+                        "@text/thing-status.invalidCoordinates");
                 cancelPolling();
                 return;
             }
index 3a5df973601899c91d3a01defc49e1bdfaa364fe..51c6bee5086e50b1cc20d713ae364996c303fc85 100644 (file)
                        <description>The hourly forecasts to display</description>
                        <limitToOptions>true</limitToOptions>
                        <options>
-                               <option value="0">Current hour</option>
-                               <option value="1">Next hour</option>
-                               <option value="2">2 hours from now</option>
-                               <option value="3">3 hours from now</option>
-                               <option value="4">4 hours from now</option>
-                               <option value="5">5 hours from now</option>
-                               <option value="6">6 hours from now</option>
-                               <option value="7">7 hours from now</option>
-                               <option value="8">8 hours from now</option>
-                               <option value="9">9 hours from now</option>
-                               <option value="10">10 hours from now</option>
-                               <option value="11">11 hours from now</option>
-                               <option value="12">12 hours from now</option>
-                               <option value="13">13 hours from now</option>
-                               <option value="14">14 hours from now</option>
-                               <option value="15">15 hours from now</option>
-                               <option value="16">16 hours from now</option>
-                               <option value="17">17 hours from now</option>
-                               <option value="18">18 hours from now</option>
-                               <option value="19">19 hours from now</option>
-                               <option value="20">20 hours from now</option>
-                               <option value="21">21 hours from now</option>
-                               <option value="22">22 hours from now</option>
-                               <option value="23">23 hours from now</option>
-                               <option value="24">24 hours from now</option>
+                               <option value="0">@text/thing-type.smhi.forecast.group.hour_0.label</option>
+                               <option value="1">@text/thing-type.smhi.forecast.group.hour_1.label</option>
+                               <option value="2">@text/thing-type.smhi.forecast.group.hour_2.label</option>
+                               <option value="3">@text/thing-type.smhi.forecast.group.hour_3.label</option>
+                               <option value="4">@text/thing-type.smhi.forecast.group.hour_4.label</option>
+                               <option value="5">@text/thing-type.smhi.forecast.group.hour_5.label</option>
+                               <option value="6">@text/thing-type.smhi.forecast.group.hour_6.label</option>
+                               <option value="7">@text/thing-type.smhi.forecast.group.hour_7.label</option>
+                               <option value="8">@text/thing-type.smhi.forecast.group.hour_8.label</option>
+                               <option value="9">@text/thing-type.smhi.forecast.group.hour_9.label</option>
+                               <option value="10">@text/thing-type.smhi.forecast.group.hour_10.label</option>
+                               <option value="11">@text/thing-type.smhi.forecast.group.hour_11.label</option>
+                               <option value="12">@text/thing-type.smhi.forecast.group.hour_12.label</option>
+                               <option value="13">@text/thing-type.smhi.forecast.group.hour_13.label</option>
+                               <option value="14">@text/thing-type.smhi.forecast.group.hour_14.label</option>
+                               <option value="15">@text/thing-type.smhi.forecast.group.hour_15.label</option>
+                               <option value="16">@text/thing-type.smhi.forecast.group.hour_16.label</option>
+                               <option value="17">@text/thing-type.smhi.forecast.group.hour_17.label</option>
+                               <option value="18">@text/thing-type.smhi.forecast.group.hour_18.label</option>
+                               <option value="19">@text/thing-type.smhi.forecast.group.hour_19.label</option>
+                               <option value="20">@text/thing-type.smhi.forecast.group.hour_20.label</option>
+                               <option value="21">@text/thing-type.smhi.forecast.group.hour_21.label</option>
+                               <option value="22">@text/thing-type.smhi.forecast.group.hour_22.label</option>
+                               <option value="23">@text/thing-type.smhi.forecast.group.hour_23.label</option>
+                               <option value="24">@text/thing-type.smhi.forecast.group.hour_24.label</option>
                        </options>
                </parameter>
                <parameter name="dailyForecasts" type="integer" multiple="true">
                        <description>The daily forecasts to display</description>
                        <limitToOptions>true</limitToOptions>
                        <options>
-                               <option value="0">Today</option>
-                               <option value="1">Tomorrow</option>
-                               <option value="2">2 days from now</option>
-                               <option value="3">3 days from now</option>
-                               <option value="4">4 days from now</option>
-                               <option value="5">5 days from now</option>
-                               <option value="6">6 days from now</option>
-                               <option value="7">7 days from now</option>
-                               <option value="8">8 days from now</option>
-                               <option value="9">9 days from now</option>
+                               <option value="0">@text/thing-type.smhi.forecast.group.day_0.label</option>
+                               <option value="1">@text/thing-type.smhi.forecast.group.day_1.label</option>
+                               <option value="2">@text/thing-type.smhi.forecast.group.day_2.label</option>
+                               <option value="3">@text/thing-type.smhi.forecast.group.day_3.label</option>
+                               <option value="4">@text/thing-type.smhi.forecast.group.day_4.label</option>
+                               <option value="5">@text/thing-type.smhi.forecast.group.day_5.label</option>
+                               <option value="6">@text/thing-type.smhi.forecast.group.day_6.label</option>
+                               <option value="7">@text/thing-type.smhi.forecast.group.day_7.label</option>
+                               <option value="8">@text/thing-type.smhi.forecast.group.day_8.label</option>
+                               <option value="9">@text/thing-type.smhi.forecast.group.day_9.label</option>
                        </options>
                </parameter>
        </config-description>
index 31439a690af92fb64615f5537b9c786d06f6bf21..9efd510b6c02fb5a4291ca74231182e243431d95 100644 (file)
@@ -82,43 +82,8 @@ thing-type.smhi.forecast.group.hour_9.description = Forecast for 9 hours from no
 
 thing-type.config.smhi.forecast.dailyForecasts.label = Daily Forecasts
 thing-type.config.smhi.forecast.dailyForecasts.description = The daily forecasts to display
-thing-type.config.smhi.forecast.dailyForecasts.option.0 = Today
-thing-type.config.smhi.forecast.dailyForecasts.option.1 = Tomorrow
-thing-type.config.smhi.forecast.dailyForecasts.option.2 = 2 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.3 = 3 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.4 = 4 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.5 = 5 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.6 = 6 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.7 = 7 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.8 = 8 days from now
-thing-type.config.smhi.forecast.dailyForecasts.option.9 = 9 days from now
 thing-type.config.smhi.forecast.hourlyForecasts.label = Hourly Forecasts
 thing-type.config.smhi.forecast.hourlyForecasts.description = The hourly forecasts to display
-thing-type.config.smhi.forecast.hourlyForecasts.option.0 = Current hour
-thing-type.config.smhi.forecast.hourlyForecasts.option.1 = Next hour
-thing-type.config.smhi.forecast.hourlyForecasts.option.2 = 2 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.3 = 3 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.4 = 4 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.5 = 5 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.6 = 6 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.7 = 7 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.8 = 8 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.9 = 9 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.10 = 10 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.11 = 11 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.12 = 12 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.13 = 13 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.14 = 14 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.15 = 15 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.16 = 16 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.17 = 17 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.18 = 18 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.19 = 19 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.20 = 20 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.21 = 21 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.22 = 22 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.23 = 23 hours from now
-thing-type.config.smhi.forecast.hourlyForecasts.option.24 = 24 hours from now
 thing-type.config.smhi.forecast.latitude.label = Latitude
 thing-type.config.smhi.forecast.latitude.description = Latitude for the forecast
 thing-type.config.smhi.forecast.longitude.label = Longitude
@@ -215,3 +180,5 @@ channel-type.smhi.wsymb2.state.option.24 = Heavy sleet
 channel-type.smhi.wsymb2.state.option.25 = Light snowfall
 channel-type.smhi.wsymb2.state.option.26 = Moderate snowfall
 channel-type.smhi.wsymb2.state.option.27 = Heavy snowfall
+
+thing-status.invalidCoordinates = Coordinates outside valid area