-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
plugins/tts-plugin/src/main/java/com/github/hui/quick/plugin/tts/service/LocaleService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, List<LocaleEnum>> getLocals() { | ||
return Arrays.stream(LocaleEnum.values()).collect(Collectors.groupingBy(LocaleEnum::getLocale)); | ||
} | ||
|
||
|
||
/** | ||
* 获取某个语言对应的语音列表 | ||
* | ||
* @param local | ||
* @return | ||
*/ | ||
public List<VoiceEnum> getVoiceByLocale(LocaleEnum local) { | ||
return Arrays.stream(VoiceEnum.values()).filter(s -> s.getLocale().equals(local.getLocale())).collect(Collectors.toList()); | ||
} | ||
} |