2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.voice.voicerss.internal;
15 import java.util.Locale;
17 import org.openhab.core.voice.Voice;
18 import org.openhab.voice.voicerss.internal.cloudapi.VoiceRSSCloudImpl;
21 * Implementation of the Voice interface for VoiceRSS. Label is only "default"
22 * as only voice supported.
24 * @author Jochen Hiller - Initial contribution and API
26 public class VoiceRSSVoice implements Voice {
31 private final Locale locale;
36 private final String label;
39 * Constructs a VoiceRSS Voice for the passed data
42 * The Locale of the voice
44 * The label of the voice
46 public VoiceRSSVoice(Locale locale, String label) {
52 * Globally unique identifier of the voice.
54 * @return A String uniquely identifying the voice globally
57 public String getUID() {
58 String uid = "voicerss:" + locale.toLanguageTag().replaceAll("[^a-zA-Z0-9_]", "");
59 if (!label.equals(VoiceRSSCloudImpl.DEFAULT_VOICE)) {
60 uid += "_" + label.replaceAll("[^a-zA-Z0-9_]", "");
66 * The voice label, used for GUI's or VUI's
68 * @return The voice label, may not be globally unique
71 public String getLabel() {
79 public Locale getLocale() {