From 54dc5c1fec3ad1655c7f0a5a6321e88b6a59ee37 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Thu, 8 Sep 2022 22:25:18 +0200 Subject: [PATCH] [upnpcontrol] Prepare dynamic channels and status messages for translation (#13364) * prepare dynamic channels and status messages for translation Signed-off-by: Mark Herwege --- .../upnpcontrol/internal/UpnpChannelName.java | 158 +++++++++++------- .../internal/handler/UpnpHandler.java | 13 +- .../internal/handler/UpnpRendererHandler.java | 27 +-- .../internal/handler/UpnpServerHandler.java | 16 +- .../OH-INF/i18n/upnpcontrol.properties | 116 +++++++++++++ 5 files changed, 240 insertions(+), 90 deletions(-) diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/UpnpChannelName.java b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/UpnpChannelName.java index 0f9b47457..9a727efa8 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/UpnpChannelName.java +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/UpnpChannelName.java @@ -33,78 +33,106 @@ import org.eclipse.jdt.annotation.Nullable; public enum UpnpChannelName { // Volume channels - LF_VOLUME("LFvolume", "Left Front Volume", "Left front volume, will be left volume with stereo sound", + LF_VOLUME("LFvolume", "@text/channel.upnpcontrol.lfvolume.label", "@text/channel.upnpcontrol.lfvolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - RF_VOLUME("RFvolume", "Right Front Volume", "Right front volume, will be left volume with stereo sound", + RF_VOLUME("RFvolume", "@text/channel.upnpcontrol.rfvolume.label", "@text/channel.upnpcontrol.rfvolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - CF_VOLUME("CFvolume", "Center Front Volume", "Center front volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - LFE_VOLUME("LFEvolume", "Frequency Enhancement Volume", "Low frequency enhancement volume (subwoofer)", + CF_VOLUME("CFvolume", "@text/channel.upnpcontrol.cfvolume.label", "@text/channel.upnpcontrol.cfvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + LFE_VOLUME("LFEvolume", "@text/channel.upnpcontrol.lfevolume.label", + "@text/channel.upnpcontrol.lfevolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + LS_VOLUME("LSvolume", "@text/channel.upnpcontrol.lsvolume.label", "@text/channel.upnpcontrol.lsvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + RS_VOLUME("RSvolume", "@text/channel.upnpcontrol.rsvolume.label", "@text/channel.upnpcontrol.rsvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + LFC_VOLUME("LFCvolume", "@text/channel.upnpcontrol.lfcvolume.label", + "@text/channel.upnpcontrol.lfcvolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + RFC_VOLUME("RFCvolume", "@text/channel.upnpcontrol.rfcvolume.label", + "@text/channel.upnpcontrol.rfcvolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + SD_VOLUME("SDvolume", "@text/channel.upnpcontrol.sdvolume.label", "@text/channel.upnpcontrol.sdvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + SL_VOLUME("SLvolume", "@text/channel.upnpcontrol.slvolume.label", "@text/channel.upnpcontrol.slvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + SR_VOLUME("SRvolume", "@text/channel.upnpcontrol.srvolume.label", "@text/channel.upnpcontrol.srvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + T_VOLUME("Tvolume", "@text/channel.upnpcontrol.tvolume.label", "@text/channel.upnpcontrol.tvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + B_VOLUME("Bvolume", "@text/channel.upnpcontrol.bvolume.label", "@text/channel.upnpcontrol.bvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + BC_VOLUME("BCvolume", "@text/channel.upnpcontrol.bcvolume.label", "@text/channel.upnpcontrol.bcvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + BL_VOLUME("BLvolume", "@text/channel.upnpcontrol.blvolume.label", "@text/channel.upnpcontrol.blvolume.description", + ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), + BR_VOLUME("BRvolume", "@text/channel.upnpcontrol.brvolume.label", "@text/channel.upnpcontrol.brvolume.description", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - LS_VOLUME("LSvolume", "Left Surround Volume", "Left surround volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - RS_VOLUME("RSvolume", "Right Surround Volume", "Right surround volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - LFC_VOLUME("LFCvolume", "Left of Center Volume", "Left of center (in front) volume", ITEM_TYPE_VOLUME, - CHANNEL_TYPE_VOLUME), - RFC_VOLUME("RFCvolume", "Right of Center Volume", "Right of center (in front) volume", ITEM_TYPE_VOLUME, - CHANNEL_TYPE_VOLUME), - SD_VOLUME("SDvolume", "Surround Volume", "Surround (rear) volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - SL_VOLUME("SLvolume", "Side Left Volume", "Side left (left wall) volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - SR_VOLUME("SRvolume", "Side Right Volume", "Side right (right wall) volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - T_VOLUME("Tvolume", "Top Volume", "Top (overhead) volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - B_VOLUME("Bvolume", "Bottom Volume", "Bottom volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - BC_VOLUME("BCvolume", "Back Center Volume", "Back center volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - BL_VOLUME("BLvolume", "Back Left Volume", "Back Left Volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), - BR_VOLUME("BRvolume", "Back Right Volume", "Back right volume", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME), // Mute channels - LF_MUTE("LFmute", "Left Front Mute", "Left front mute, will be left mute with stereo sound", ITEM_TYPE_MUTE, - CHANNEL_TYPE_MUTE), - RF_MUTE("RFmute", "Right Front Mute", "Right front mute, will be left mute with stereo sound", ITEM_TYPE_MUTE, - CHANNEL_TYPE_MUTE), - CF_MUTE("CFmute", "Center Front Mute", "Center front mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - LFE_MUTE("LFEmute", "Frequency Enhancement Mute", "Low frequency enhancement mute (subwoofer)", ITEM_TYPE_MUTE, - CHANNEL_TYPE_MUTE), - LS_MUTE("LSmute", "Left Surround Mute", "Left surround mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - RS_MUTE("RSmute", "Right Surround Mute", "Right surround mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - LFC_MUTE("LFCmute", "Left of Center Mute", "Left of center (in front) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - RFC_MUTE("RFCmute", "Right of Center Mute", "Right of center (in front) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - SD_MUTE("SDmute", "Surround Mute", "Surround (rear) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - SL_MUTE("SLmute", "Side Left Mute", "Side left (left wall) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - SR_MUTE("SRmute", "Side Right Mute", "Side right (right wall) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - T_MUTE("Tmute", "Top Mute", "Top (overhead) mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - B_MUTE("Bmute", "Bottom Mute", "Bottom mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - BC_MUTE("BCmute", "Back Center Mute", "Back center mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - BL_MUTE("BLmute", "Back Left Mute", "Back Left Mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), - BR_MUTE("BRmute", "Back Right Mute", "Back right mute", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + LF_MUTE("LFmute", "@text/channel.upnpcontrol.lfmute.label", "@text/channel.upnpcontrol.lfmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + RF_MUTE("RFmute", "@text/channel.upnpcontrol.rfmute.label", "@text/channel.upnpcontrol.rfmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + CF_MUTE("CFmute", "@text/channel.upnpcontrol.cfmute.label", "@text/channel.upnpcontrol.cfmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + LFE_MUTE("LFEmute", "@text/channel.upnpcontrol.lfemute.label", "@text/channel.upnpcontrol.lfemute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + LS_MUTE("LSmute", "@text/channel.upnpcontrol.lsmute.label", "@text/channel.upnpcontrol.lsmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + RS_MUTE("RSmute", "@text/channel.upnpcontrol.rsmute.label", "@text/channel.upnpcontrol.rsmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + LFC_MUTE("LFCmute", "@text/channel.upnpcontrol.lfcmute.label", "@text/channel.upnpcontrol.lfcmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + RFC_MUTE("RFCmute", "@text/channel.upnpcontrol.rfcmute.label", "@text/channel.upnpcontrol.rfcmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + SD_MUTE("SDmute", "@text/channel.upnpcontrol.sdmute.label", "@text/channel.upnpcontrol.sdmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + SL_MUTE("SLmute", "@text/channel.upnpcontrol.slmute.label", "@text/channel.upnpcontrol.slmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + SR_MUTE("SRmute", "@text/channel.upnpcontrol.srmute.label", "@text/channel.upnpcontrol.srmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + T_MUTE("Tmute", "@text/channel.upnpcontrol.tmute.label", "@text/channel.upnpcontrol.tmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + B_MUTE("Bmute", "@text/channel.upnpcontrol.bmute.label", "@text/channel.upnpcontrol.bmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + BC_MUTE("BCmute", "@text/channel.upnpcontrol.bcmute.label", "@text/channel.upnpcontrol.bcmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + BL_MUTE("BLmute", "@text/channel.upnpcontrol.blmute.label", "@text/channel.upnpcontrol.blmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), + BR_MUTE("BRmute", "@text/channel.upnpcontrol.brmute.label", "@text/channel.upnpcontrol.brmute.description", + ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE), // Loudness channels - LOUDNESS("loudness", "Loudness", "Master loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - LF_LOUDNESS("LFloudness", "Left Front Loudness", "Left front loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - RF_LOUDNESS("RFloudness", "Right Front Loudness", "Right front loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - CF_LOUDNESS("CFloudness", "Center Front Loudness", "Center front loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - LFE_LOUDNESS("LFEloudness", "Frequency Enhancement Loudness", "Low frequency enhancement loudness (subwoofer)", - ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - LS_LOUDNESS("LSloudness", "Left Surround Loudness", "Left surround loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - RS_LOUDNESS("RSloudness", "Right Surround Loudness", "Right surround loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - LFC_LOUDNESS("LFCloudness", "Left of Center Loudness", "Left of center (in front) loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - RFC_LOUDNESS("RFCloudness", "Right of Center Loudness", "Right of center (in front) loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - SD_LOUDNESS("SDloudness", "Surround Loudness", "Surround (rear) loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - SL_LOUDNESS("SLloudness", "Side Left Loudness", "Side left (left wall) loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - SR_LOUDNESS("SRloudness", "Side Right Loudness", "Side right (right wall) loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - T_LOUDNESS("Tloudness", "Top Loudness", "Top (overhead) loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - B_LOUDNESS("Bloudness", "Bottom Loudness", "Bottom loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - BC_LOUDNESS("BCloudness", "Back Center Loudness", "Back center loudness", ITEM_TYPE_LOUDNESS, - CHANNEL_TYPE_LOUDNESS), - BL_LOUDNESS("BLloudness", "Back Left Loudness", "Back Left Loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), - BR_LOUDNESS("BRloudness", "Back Right Loudness", "Back right loudness", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS); + LF_LOUDNESS("LFloudness", "@text/channel.upnpcontrol.lfloudness.label", + "@text/channel.upnpcontrol.lfloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + RF_LOUDNESS("RFloudness", "@text/channel.upnpcontrol.rfloudness.label", + "@text/channel.upnpcontrol.rfloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + CF_LOUDNESS("CFloudness", "@text/channel.upnpcontrol.cfloudness.label", + "@text/channel.upnpcontrol.cfloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + LFE_LOUDNESS("LFEloudness", "@text/channel.upnpcontrol.lfeloudness.label", + "@text/channel.upnpcontrol.lfeloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + LS_LOUDNESS("LSloudness", "@text/channel.upnpcontrol.lsloudness.label", + "@text/channel.upnpcontrol.lsloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + RS_LOUDNESS("RSloudness", "@text/channel.upnpcontrol.rsloudness.label", + "@text/channel.upnpcontrol.rsloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + LFC_LOUDNESS("LFCloudness", "@text/channel.upnpcontrol.lfcloudness.label", + "@text/channel.upnpcontrol.lfcloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + RFC_LOUDNESS("RFCloudness", "@text/channel.upnpcontrol.rfcloudness.label", + "@text/channel.upnpcontrol.rfcloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + SD_LOUDNESS("SDloudness", "@text/channel.upnpcontrol.sdloudness.label", + "@text/channel.upnpcontrol.sdloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + SL_LOUDNESS("SLloudness", "@text/channel.upnpcontrol.slloudness.label", + "@text/channel.upnpcontrol.slloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + SR_LOUDNESS("SRloudness", "@text/channel.upnpcontrol.srloudness.label", + "@text/channel.upnpcontrol.srloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + T_LOUDNESS("Tloudness", "@text/channel.upnpcontrol.tloudness.label", + "@text/channel.upnpcontrol.tloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + B_LOUDNESS("Bloudness", "@text/channel.upnpcontrol.bloudness.label", + "@text/channel.upnpcontrol.bloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + BC_LOUDNESS("BCloudness", "@text/channel.upnpcontrol.bcloudness.label", + "@text/channel.upnpcontrol.bcloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + BL_LOUDNESS("BLloudness", "@text/channel.upnpcontrol.blloudness.label", + "@text/channel.upnpcontrol.blloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS), + BR_LOUDNESS("BRloudness", "@text/channel.upnpcontrol.brloudness.label", + "@text/channel.upnpcontrol.brloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS); private static final Map UPNP_CHANNEL_NAME_MAP = Stream.of(UpnpChannelName.values()) .collect(Collectors.toMap(UpnpChannelName::getChannelId, Function.identity())); diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpHandler.java b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpHandler.java index 0c3f3cc1e..9c4b406ec 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpHandler.java +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpHandler.java @@ -199,8 +199,8 @@ public abstract class UpnpHandler extends BaseThingHandler implements UpnpIOPart pollingJob = upnpScheduler.scheduleWithFixedDelay(this::initJob, 0, config.refresh, TimeUnit.SECONDS); } } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "No UDN configured for " + thing.getLabel()); + String msg = String.format("@text/offline.no-udn [ \"%s\" ]", thing.getLabel()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); } } @@ -398,8 +398,9 @@ public abstract class UpnpHandler extends BaseThingHandler implements UpnpIOPart service); if (!succeeded) { upnpSubscribed = false; - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Could not subscribe to service " + service + "for" + thing.getLabel()); + String msg = String.format("@text/offline.subscription-failed [ \"%1$s\", \"%2$s\" ]", service, + thing.getLabel()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, msg); } } @@ -409,8 +410,8 @@ public abstract class UpnpHandler extends BaseThingHandler implements UpnpIOPart if (status) { initJob(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Communication lost with " + thing.getLabel()); + String msg = String.format("@text/offline.communication-lost [ \"%s\" ]", thing.getLabel()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, msg); } } diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java index 5ae12adc4..98af50211 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java @@ -187,16 +187,16 @@ public class UpnpRendererHandler extends UpnpHandler { if (favoriteSelectChannel != null) { favoriteSelectChannelUID = favoriteSelectChannel.getUID(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "Channel " + FAVORITE_SELECT + " not defined"); + String msg = String.format("@text/offline.channel-undefined [ \"%s\" ]", FAVORITE_SELECT); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); return; } Channel playlistSelectChannel = thing.getChannel(PLAYLIST_SELECT); if (playlistSelectChannel != null) { playlistSelectChannelUID = playlistSelectChannel.getUID(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "Channel " + PLAYLIST_SELECT + " not defined"); + String msg = String.format("@text/offline.channel-undefined [ \"%s\" ]", PLAYLIST_SELECT); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); return; } @@ -221,8 +221,8 @@ public class UpnpRendererHandler extends UpnpHandler { protected void initJob() { synchronized (jobLock) { if (!upnpIOService.isRegistered(this)) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "UPnP device with UDN " + getUDN() + " not yet registered"); + String msg = String.format("@text/offline.device-not-registered [ \"%s\" ]", getUDN()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, msg); return; } @@ -231,8 +231,8 @@ public class UpnpRendererHandler extends UpnpHandler { getCurrentConnectionInfo(); if (!checkForConnectionIds()) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "No connection Id's set for UPnP device with UDN " + getUDN()); + String msg = String.format("@text/offline.no-connection-ids [ \"%s\" ]", getUDN()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, msg); return; } @@ -276,7 +276,9 @@ public class UpnpRendererHandler extends UpnpHandler { if (UpnpChannelName.channelIdToUpnpChannelName(name) != null) { createChannel(UpnpChannelName.channelIdToUpnpChannelName(name)); } else { - createChannel(name, name, "Vendor specific UPnP volume channel", ITEM_TYPE_VOLUME, CHANNEL_TYPE_VOLUME); + String label = String.format("@text/channel.upnpcontrol.vendorvolume.label [ \"%s\" ]", audioChannel); + createChannel(name, label, "@text/channel.upnpcontrol.vendorvolume.description", ITEM_TYPE_VOLUME, + CHANNEL_TYPE_VOLUME); } } if (config.mute && !UPNP_MASTER.equals(audioChannel)) { @@ -284,7 +286,9 @@ public class UpnpRendererHandler extends UpnpHandler { if (UpnpChannelName.channelIdToUpnpChannelName(name) != null) { createChannel(UpnpChannelName.channelIdToUpnpChannelName(name)); } else { - createChannel(name, name, "Vendor specific UPnP mute channel", ITEM_TYPE_MUTE, CHANNEL_TYPE_MUTE); + String label = String.format("@text/channel.upnpcontrol.vendormute.label [ \"%s\" ]", audioChannel); + createChannel(name, label, "@text/channel.upnpcontrol.vendormute.description", ITEM_TYPE_MUTE, + CHANNEL_TYPE_MUTE); } } if (config.loudness) { @@ -292,7 +296,8 @@ public class UpnpRendererHandler extends UpnpHandler { if (UpnpChannelName.channelIdToUpnpChannelName(name) != null) { createChannel(UpnpChannelName.channelIdToUpnpChannelName(name)); } else { - createChannel(name, name, "Vendor specific UPnP loudness channel", ITEM_TYPE_LOUDNESS, + String label = String.format("@text/channel.upnpcontrol.vendorloudness.label [ \"%s\" ]", audioChannel); + createChannel(name, label, "@text/channel.upnpcontrol.vendorloudness.description", ITEM_TYPE_LOUDNESS, CHANNEL_TYPE_LOUDNESS); } } diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpServerHandler.java b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpServerHandler.java index 43aaf09b4..3284967d7 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpServerHandler.java +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpServerHandler.java @@ -124,24 +124,24 @@ public class UpnpServerHandler extends UpnpHandler { if (rendererChannel != null) { rendererChannelUID = rendererChannel.getUID(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "Channel " + UPNPRENDERER + " not defined"); + String msg = String.format("@text/offline.channel-undefined [ \"%s\" ]", UPNPRENDERER); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); return; } Channel selectionChannel = thing.getChannel(BROWSE); if (selectionChannel != null) { currentSelectionChannelUID = selectionChannel.getUID(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "Channel " + BROWSE + " not defined"); + String msg = String.format("@text/offline.channel-undefined [ \"%s\" ]", BROWSE); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); return; } Channel playlistSelectChannel = thing.getChannel(PLAYLIST_SELECT); if (playlistSelectChannel != null) { playlistSelectChannelUID = playlistSelectChannel.getUID(); } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, - "Channel " + PLAYLIST_SELECT + " not defined"); + String msg = String.format("@text/offline.channel-undefined [ \"%s\" ]", PLAYLIST_SELECT); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, msg); return; } @@ -165,8 +165,8 @@ public class UpnpServerHandler extends UpnpHandler { protected void initJob() { synchronized (jobLock) { if (!upnpIOService.isRegistered(this)) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "UPnP device with UDN " + getUDN() + " not yet registered"); + String msg = String.format("@text/offline.device-not-registered [ \"%s\" ]", getUDN()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, msg); return; } diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/resources/OH-INF/i18n/upnpcontrol.properties b/bundles/org.openhab.binding.upnpcontrol/src/main/resources/OH-INF/i18n/upnpcontrol.properties index f84d6ced3..e80d03ce8 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/resources/OH-INF/i18n/upnpcontrol.properties +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/resources/OH-INF/i18n/upnpcontrol.properties @@ -44,6 +44,113 @@ thing-type.config.upnpcontrol.upnpserver.sortCriteria.description = Sort criteri thing-type.config.upnpcontrol.upnpserver.udn.label = Unique Device Name thing-type.config.upnpcontrol.upnpserver.udn.description = The UDN identifies the UPnP Media Server +# dynamic channels + +channel.upnpcontrol.lfvolume.label = Left Front Volume +channel.upnpcontrol.lfvolume.description = Left front volume, will be left volume with stereo sound +channel.upnpcontrol.rfvolume.label = Right Front Volume +channel.upnpcontrol.rfvolume.description = Right front volume, will be right volume with stereo sound +channel.upnpcontrol.cfvolume.label = Center Front Volume +channel.upnpcontrol.cfvolume.description = Center front volume +channel.upnpcontrol.lfevolume.label = Low Frequency Enhancement Volume +channel.upnpcontrol.lfevolume.description = Low frequency enhancement volume (subwoofer) +channel.upnpcontrol.lsvolume.label = Left Surround Volume +channel.upnpcontrol.lsvolume.description = Left surround volume +channel.upnpcontrol.rsvolume.label = Right Surround Volume +channel.upnpcontrol.rsvolume.description = Right surround volume +channel.upnpcontrol.lfcvolume.label = Left of Center Volume +channel.upnpcontrol.lfcvolume.description = Left of center (in front) volume +channel.upnpcontrol.rfcvolume.label = Right of Center Volume +channel.upnpcontrol.rfcvolume.description = Right of center (in front) volume +channel.upnpcontrol.sdvolume.label = Surround Volume +channel.upnpcontrol.sdvolume.description = Surround (rear) volume +channel.upnpcontrol.slvolume.label = Side Left Volume +channel.upnpcontrol.slvolume.description = Side left (left wall) volume +channel.upnpcontrol.srvolume.label = Side Right Volume +channel.upnpcontrol.srvolume.description = Side right (right wall) volume +channel.upnpcontrol.tvolume.label = Top Volume +channel.upnpcontrol.tvolume.description = Top (overhead) volume +channel.upnpcontrol.bvolume.label = Bottom Volume +channel.upnpcontrol.bvolume.description = Bottom volume +channel.upnpcontrol.bcvolume.label = Back Center Volume +channel.upnpcontrol.bcvolume.description = Back center volume +channel.upnpcontrol.blvolume.label = Back Left Volume +channel.upnpcontrol.blvolume.description = Back left volume +channel.upnpcontrol.brvolume.label = Back Right Volume +channel.upnpcontrol.brvolume.description = Back right volume +channel.upnpcontrol.vendorvolume.label = {0} Volume +channel.upnpcontrol.vendorvolume.description = Vendor specific UPnP volume channel + +channel.upnpcontrol.lfmute.label = Left Front Mute +channel.upnpcontrol.lfmute.description = Left front mute, will be left mute with stereo sound +channel.upnpcontrol.rfmute.label = Right Front Mute +channel.upnpcontrol.rfmute.description = Right front mute, will be right mute with stereo sound +channel.upnpcontrol.cfmute.label = Center Front Mute +channel.upnpcontrol.cfmute.description = Center front mute +channel.upnpcontrol.lfemute.label = Low Frequency Enhancement Mute +channel.upnpcontrol.lfemute.description = Low frequency enhancement mute (subwoofer) +channel.upnpcontrol.lsmute.label = Left Surround Mute +channel.upnpcontrol.lsmute.description = Left surround mute +channel.upnpcontrol.rsmute.label = Right Surround Mute +channel.upnpcontrol.rsmute.description = Right surround mute +channel.upnpcontrol.lfcmute.label = Left of Center Mute +channel.upnpcontrol.lfcmute.description = Left of center (in front) mute +channel.upnpcontrol.rfcmute.label = Right of Center Mute +channel.upnpcontrol.rfcmute.description = Right of center (in front) mute +channel.upnpcontrol.sdmute.label = Surround Mute +channel.upnpcontrol.sdmute.description = Surround (rear) mute +channel.upnpcontrol.slmute.label = Side Left Mute +channel.upnpcontrol.slmute.description = Side left (left wall) mute +channel.upnpcontrol.srmute.label = Side Right Mute +channel.upnpcontrol.srmute.description = Side right (right wall) mute +channel.upnpcontrol.tmute.label = Top Mute +channel.upnpcontrol.tmute.description = Top (overhead) mute +channel.upnpcontrol.bmute.label = Bottom Mute +channel.upnpcontrol.bmute.description = Bottom mute +channel.upnpcontrol.bcmute.label = Back Center Mute +channel.upnpcontrol.bcmute.description = Back center mute +channel.upnpcontrol.blmute.label = Back Left Mute +channel.upnpcontrol.blmute.description = Back left mute +channel.upnpcontrol.brmute.label = Back Right Mute +channel.upnpcontrol.brmute.description = Back right mute +channel.upnpcontrol.vendormute.label = {0} Mute +channel.upnpcontrol.vendormute.description = Vendor specific UPnP mute channel + +channel.upnpcontrol.lfloudness.label = Left Front Loudness +channel.upnpcontrol.lfloudness.description = Left front loudness, will be left loudness with stereo sound +channel.upnpcontrol.rfloudness.label = Right Front Loudness +channel.upnpcontrol.rfloudness.description = Right front loudness, will be right loudness with stereo sound +channel.upnpcontrol.cfloudness.label = Center Front Loudness +channel.upnpcontrol.cfloudness.description = Center front loudness +channel.upnpcontrol.lfeloudness.label = Low Frequency Enhancement Loudness +channel.upnpcontrol.lfeloudness.description = Low frequency enhancement loudness (subwoofer) +channel.upnpcontrol.lsloudness.label = Left Surround Loudness +channel.upnpcontrol.lsloudness.description = Left surround loudness +channel.upnpcontrol.rsloudness.label = Right Surround Loudness +channel.upnpcontrol.rsloudness.description = Right surround loudness +channel.upnpcontrol.lfcloudness.label = Left of Center Loudness +channel.upnpcontrol.lfcloudness.description = Left of center (in front) loudness +channel.upnpcontrol.rfcloudness.label = Right of Center Loudness +channel.upnpcontrol.rfcloudness.description = Right of center (in front) loudness +channel.upnpcontrol.sdloudness.label = Surround Loudness +channel.upnpcontrol.sdloudness.description = Surround (rear) loudness +channel.upnpcontrol.slloudness.label = Side Left Loudness +channel.upnpcontrol.slloudness.description = Side left (left wall) loudness +channel.upnpcontrol.srloudness.label = Side Right Loudness +channel.upnpcontrol.srloudness.description = Side right (right wall) loudness +channel.upnpcontrol.tloudness.label = Top Loudness +channel.upnpcontrol.tloudness.description = Top (overhead) loudness +channel.upnpcontrol.bloudness.label = Bottom Loudness +channel.upnpcontrol.bloudness.description = Bottom loudness +channel.upnpcontrol.bcloudness.label = Back Center Loudness +channel.upnpcontrol.bcloudness.description = Back center loudness +channel.upnpcontrol.blloudness.label = Back Left Loudness +channel.upnpcontrol.blloudness.description = Back left loudness +channel.upnpcontrol.brloudness.label = Back Right Loudness +channel.upnpcontrol.brloudness.description = Back right loudness +channel.upnpcontrol.vendorloudness.label = {0} Loudness +channel.upnpcontrol.vendorloudness.description = Vendor specific UPnP loudness channel + # channel types channel-type.upnpcontrol.album.label = Album @@ -100,3 +207,12 @@ channel-type.upnpcontrol.upnprenderer.label = Renderer channel-type.upnpcontrol.upnprenderer.description = Select AV renderer channel-type.upnpcontrol.uri.label = URI channel-type.upnpcontrol.uri.description = Now playing URI + +# thing status messages + +offline.no-udn = No UDN configured for {0} +offline.subscription-failed = Could not subscribe to service {0} for {1} +offline.communication-lost = Communication lost with {0} +offline.channel-undefined = Channel {0} not defined +offline.device-not-registered = UPnP device with UDN {0} not yet registered +offline.no-connection-ids = No connection Id's set for UPnP device with UDN {0}