import org.openhab.core.config.discovery.AbstractThingHandlerDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
+import org.openhab.core.i18n.LocaleProvider;
+import org.openhab.core.i18n.TranslationProvider;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.ThingUID;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ServiceScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
DISCOVERY_TIME_SECONDS);
}
+ @Reference(unbind = "-")
+ public void bindTranslationProvider(TranslationProvider translationProvider) {
+ this.i18nProvider = translationProvider;
+ }
+
+ @Reference(unbind = "-")
+ public void bindLocaleProvider(LocaleProvider localeProvider) {
+ this.localeProvider = localeProvider;
+ }
+
@Override
protected void startBackgroundDiscovery() {
stopBackgroundDiscovery();
ThingUID thingUID = new ThingUID(THING_TYPE_CALL, bridgeUID, "calls");
logger.debug("Adding new Call thing {} to inbox", thingUID);
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
- .withLabel("Phone Calls").build();
+ .withLabel("@text/discovery.call.label").build();
thingDiscovered(discoveryResult);
}
}
bridgeUID, mac.toHexString(false));
logger.debug("Adding new Freebox Network Host {} to inbox", thingUID);
DiscoveryResultBuilder builder = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
- .withLabel(lanHost.getPrimaryName().orElse("Network Device %s".formatted(macString)))
+ .withLabel(lanHost.getPrimaryName()
+ .orElse("@text/discovery.network-device.label [ \"%s\" ]".formatted(macString)))
.withTTL(300).withProperty(Thing.PROPERTY_MAC_ADDRESS, macString)
.withRepresentationProperty(Thing.PROPERTY_MAC_ADDRESS);
thingDiscovered(builder.build());
logger.debug("Adding new VM Device {} to inbox", thingUID);
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
.withRepresentationProperty(Thing.PROPERTY_MAC_ADDRESS)
- .withLabel("%s (VM)".formatted(vm.name())).withProperty(ClientConfiguration.ID, vm.id())
+ .withLabel("@text/discovery.vm.label [ \"%s\" ]".formatted(vm.name()))
+ .withProperty(ClientConfiguration.ID, vm.id())
.withProperty(Thing.PROPERTY_MAC_ADDRESS, mac.toColonDelimitedString()).build();
thingDiscovered(discoveryResult);
});
ThingUID thingUID = new ThingUID(THING_TYPE_REPEATER, bridgeUID, Integer.toString(repeater.id()));
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
- .withLabel("Repeater %s".formatted(repeater.name()))
+ .withLabel("@text/discovery.repeater.label [ \"%s\" ]".formatted(repeater.name()))
.withProperty(Thing.PROPERTY_MAC_ADDRESS, mac.toColonDelimitedString())
.withProperty(ClientConfiguration.ID, repeater.id())
.withRepresentationProperty(Thing.PROPERTY_MAC_ADDRESS).build();