]> git.basschouten.com Git - openhab-addons.git/blob
a5e361a4ecb63e3ca99d53adbe65bfa2b15a60d9
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.voice.picotts.internal;
14
15 import java.util.Locale;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.voice.Voice;
19
20 /**
21  * Implementation of the Voice interface for PicoTTS
22  *
23  * @author Florian Schmidt - Initial Contribution
24  */
25 @NonNullByDefault
26 public class PicoTTSVoice implements Voice {
27     private final String languageTag;
28
29     public PicoTTSVoice(String languageTag) {
30         this.languageTag = languageTag;
31     }
32
33     @Override
34     public String getUID() {
35         return "picotts:" + languageTag.replaceAll("[^a-zA-Z0-9_]", "");
36     }
37
38     @Override
39     public String getLabel() {
40         return languageTag;
41     }
42
43     @Override
44     public Locale getLocale() {
45         return Locale.forLanguageTag(languageTag);
46     }
47 }