diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicDynamicStateDescriptionProvider.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicDynamicStateDescriptionProvider.java index aa8bc74ac1..4e6d93799b 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicDynamicStateDescriptionProvider.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicDynamicStateDescriptionProvider.java @@ -21,6 +21,7 @@ import org.openhab.core.thing.type.DynamicStateDescriptionProvider; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; +import org.slf4j.LoggerFactory; /** * Dynamic provider of state options while leaving other state description fields as original. @@ -30,7 +31,6 @@ import org.osgi.service.component.annotations.Reference; @Component(service = { DynamicStateDescriptionProvider.class, MagicDynamicStateDescriptionProvider.class }) @NonNullByDefault public class MagicDynamicStateDescriptionProvider extends BaseDynamicStateDescriptionProvider { - @Activate public MagicDynamicStateDescriptionProvider(final @Reference EventPublisher eventPublisher, // final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService, // @@ -38,5 +38,11 @@ public class MagicDynamicStateDescriptionProvider extends BaseDynamicStateDescri this.eventPublisher = eventPublisher; this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; this.itemChannelLinkRegistry = itemChannelLinkRegistry; + + LoggerFactory.getLogger(getClass()).error("called activate constructor"); + } + + public void activate() { + LoggerFactory.getLogger(getClass()).error("called activate method"); } } diff --git a/tools/i18n-plugin/src/main/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverter.java b/tools/i18n-plugin/src/main/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverter.java index 394a6869d1..fc64e3dff4 100644 --- a/tools/i18n-plugin/src/main/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverter.java +++ b/tools/i18n-plugin/src/main/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverter.java @@ -20,6 +20,7 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.regex.Matcher; import java.util.stream.Stream; import java.util.stream.Stream.Builder; @@ -351,7 +352,9 @@ public class XmlToTranslationsConverter { entriesBuilder.add(entry(String.format("%s.description", parameterKeyPrefix), parameter.getDescription())); parameter.getOptions().stream() - .map(option -> entry(String.format("%s.option.%s", parameterKeyPrefix, option.getValue()), + .map(option -> entry( + String.format("%s.option.%s", parameterKeyPrefix, + option.getValue().replaceAll(" ", Matcher.quoteReplacement("\\ "))), option.getLabel())) .forEach(entriesBuilder::add); diff --git a/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/PropertiesToTranslationsConverterTest.java b/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/PropertiesToTranslationsConverterTest.java index 64d4e9556c..e6da72b264 100644 --- a/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/PropertiesToTranslationsConverterTest.java +++ b/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/PropertiesToTranslationsConverterTest.java @@ -39,7 +39,7 @@ public class PropertiesToTranslationsConverterTest { assertThat(translations.hasTranslations(), is(true)); assertThat(translations.sections.size(), is(6)); - assertThat(translations.keysStream().count(), is(31L)); + assertThat(translations.keysStream().count(), is(32L)); String lines = translations.linesStream().collect(Collectors.joining(System.lineSeparator())); assertThat(lines, containsString("# binding")); diff --git a/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverterTest.java b/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverterTest.java index 533201952e..6c0360d51f 100644 --- a/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverterTest.java +++ b/tools/i18n-plugin/src/test/java/org/openhab/core/tools/i18n/plugin/XmlToTranslationsConverterTest.java @@ -42,7 +42,7 @@ public class XmlToTranslationsConverterTest { assertThat(translations.hasTranslations(), is(true)); assertThat(translations.sections.size(), is(7)); - assertThat(translations.keysStream().count(), is(30L)); + assertThat(translations.keysStream().count(), is(31L)); String lines = translations.linesStream().collect(Collectors.joining(System.lineSeparator())); assertThat(lines, containsString("# binding")); @@ -53,6 +53,8 @@ public class XmlToTranslationsConverterTest { "channel-group-type.acmeweather.forecast.channel.minTemperature.description = Minimum forecasted temperature in degrees Celsius (metric) or Fahrenheit (imperial).")); assertThat(lines, containsString( "channel-type.acmeweather.time-stamp.state.pattern = %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS")); + assertThat(lines, + containsString("thing-type.config.acmeweather.weather.language.option.de\\ DE = German (Germany)")); } @Test diff --git a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/config/config.xml b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/config/config.xml index f738ff332a..304e9b62b6 100644 --- a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/config/config.xml +++ b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/config/config.xml @@ -15,7 +15,8 @@ Language to be used by the ACME API. - + + diff --git a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.generated.properties b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.generated.properties index bbbddaebdf..22291d9e72 100644 --- a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.generated.properties +++ b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.generated.properties @@ -19,7 +19,8 @@ thing-type.acmeweather.weather.channel.minTemperature.description = Minimum temp thing-type.config.acmeweather.weather.language.label = Language thing-type.config.acmeweather.weather.language.description = Language to be used by the ACME API. thing-type.config.acmeweather.weather.language.option.nl = Dutch -thing-type.config.acmeweather.weather.language.option.de = German +thing-type.config.acmeweather.weather.language.option.de\ DE = German (Germany) +thing-type.config.acmeweather.weather.language.option.de\ CH = German (Switzerland) thing-type.config.acmeweather.weather.language.option.en = English thing-type.config.acmeweather.weather.language.option.fr = French thing-type.config.acmeweather.weather.refreshInterval.label = Refresh Interval diff --git a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.properties b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.properties index 3dc43a53a9..d6485f0417 100644 --- a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.properties +++ b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather.properties @@ -19,7 +19,8 @@ thing-type.acmeweather.weather.channel.minTemperature.description = Minimum temp thing-type.config.acmeweather.weather.language.label = Language thing-type.config.acmeweather.weather.language.description = Language to be used by the ACME API. thing-type.config.acmeweather.weather.language.option.nl = Dutch -thing-type.config.acmeweather.weather.language.option.de = German +thing-type.config.acmeweather.weather.language.option.de\ DE = German (Germany) +thing-type.config.acmeweather.weather.language.option.de\ CH = German (Switzerland) thing-type.config.acmeweather.weather.language.option.en = English thing-type.config.acmeweather.weather.language.option.fr = French thing-type.config.acmeweather.weather.refreshInterval.label = Refresh Interval diff --git a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather_de.properties b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather_de.properties index de7bd445cc..f367517da5 100644 --- a/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather_de.properties +++ b/tools/i18n-plugin/src/test/resources/acmeweather.bundle/OH-INF/i18n/acmeweather_de.properties @@ -19,7 +19,8 @@ thing-type.acmeweather.weather.channel.minTemperature.description = Minimale Tem thing-type.config.acmeweather.weather.language.label = Sprache thing-type.config.acmeweather.weather.language.description = Sprache zur Anzeige der Daten. thing-type.config.acmeweather.weather.language.option.nl = Holländisch -thing-type.config.acmeweather.weather.language.option.de = Deutsch +thing-type.config.acmeweather.weather.language.option.de\ DE = Deutsch (Deutschland) +thing-type.config.acmeweather.weather.language.option.de\ CH = Deutsch (Schweitz) thing-type.config.acmeweather.weather.language.option.en = Englisch thing-type.config.acmeweather.weather.language.option.fr = Französisch thing-type.config.acmeweather.weather.refreshInterval.label = Abfrageintervall