From 1c00fb3800e683b535019a4af8e84a326f2ae376 Mon Sep 17 00:00:00 2001 From: YiHui Date: Fri, 26 Jul 2024 10:57:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AF=AD=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/tts/service/LocaleService.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/tts-plugin/src/main/java/com/github/hui/quick/plugin/tts/service/LocaleService.java diff --git a/plugins/tts-plugin/src/main/java/com/github/hui/quick/plugin/tts/service/LocaleService.java b/plugins/tts-plugin/src/main/java/com/github/hui/quick/plugin/tts/service/LocaleService.java new file mode 100644 index 00000000..08d1b6e2 --- /dev/null +++ b/plugins/tts-plugin/src/main/java/com/github/hui/quick/plugin/tts/service/LocaleService.java @@ -0,0 +1,38 @@ +package com.github.hui.quick.plugin.tts.service; + +import com.github.hui.quick.plugin.tts.constant.LocaleEnum; +import com.github.hui.quick.plugin.tts.constant.VoiceEnum; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 语音相关服务 + * + * @author YiHui + * @date 2024/7/26 + */ +public class LocaleService { + + /** + * 根据大语言类型,获取对应的语言枚举 + * + * @return + */ + public Map> getLocals() { + return Arrays.stream(LocaleEnum.values()).collect(Collectors.groupingBy(LocaleEnum::getLocale)); + } + + + /** + * 获取某个语言对应的语音列表 + * + * @param local + * @return + */ + public List getVoiceByLocale(LocaleEnum local) { + return Arrays.stream(VoiceEnum.values()).filter(s -> s.getLocale().equals(local.getLocale())).collect(Collectors.toList()); + } +}