]> git.basschouten.com Git - openhab-addons.git/blob
5c33afefada25521bebee4f9dc81eaf4edd6d6d3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.openhab.core.voice.Voice;
18
19 /**
20  * Implementation of the Voice interface for PicoTTS
21  *
22  * @author Florian Schmidt - Initial Contribution
23  */
24 public class PicoTTSVoice implements Voice {
25     private final String languageTag;
26
27     public PicoTTSVoice(String languageTag) {
28         this.languageTag = languageTag;
29     }
30
31     @Override
32     public String getUID() {
33         return "picotts:" + languageTag.replaceAll("[^a-zA-Z0-9_]", "");
34     }
35
36     @Override
37     public String getLabel() {
38         return languageTag;
39     }
40
41     @Override
42     public Locale getLocale() {
43         return Locale.forLanguageTag(languageTag);
44     }
45 }