Commit d7c6c6c6 authored by alex yao's avatar alex yao

feat:Agent应用音色对系统环境语言匹配

parent 4dbdd27c
package cn.com.poc.timbre.constants;
/**
* 系统环境语言匹配
* @deprecated
* 作用在AgentApplication应用的音色配置
* 获取当前系统环境语言,匹配对应的音色类型
* 例如:
* 1.系统环境语言为简体,则匹配音色类型为【中文】,matchLang="zh-CN"
* 2.系统环境语言为繁体,则匹配音色类型为【粤语】,matchLang="zh-HK"
* 3.系统环境语言为英语,则匹配音色类型为【英文】,matchLang="en"
*
* @author alex.yao
*/
public enum MatchLangEnum {
zh_CN(0, "zh-CN"),
zh_HK(1, "zh-HK"),
en(2, "en");
private int language;
private String matchLang;
MatchLangEnum(int language, String matchLang) {
this.language = language;
this.matchLang = matchLang;
}
public int getLanguage() {
return language;
}
public String getMatchLang() {
return matchLang;
}
public String getMatchLangByLanguage(int language) {
for (MatchLangEnum matchLang : MatchLangEnum.values()) {
if (matchLang.language == language) {
return matchLang.matchLang;
}
}
return null;
}
}
package cn.com.poc.timbre.convert;
import cn.com.poc.timbre.constants.MatchLangEnum;
import cn.com.poc.timbre.dto.GetTimbreDto;
import cn.com.poc.timbre.dto.TimbreInfo;
import cn.com.poc.timbre.entity.BizVoiceTimbreEntity;
......@@ -72,17 +73,20 @@ public class BizVoiceTimbreConvert {
List<TimbreInfo> cnTimbreInfos = new ArrayList<>();
GetTimbreDto cnDto = new GetTimbreDto();
cnDto.setLanguage(0);
cnDto.setMatchLang(MatchLangEnum.zh_CN.getMatchLang());
cnDto.setTimbreInfo(cnTimbreInfos);
List<TimbreInfo> cantonTimbreInfos = new ArrayList<>();
GetTimbreDto cantonDto = new GetTimbreDto();
cantonDto.setLanguage(1);
cantonDto.setMatchLang(MatchLangEnum.zh_HK.getMatchLang());
cantonDto.setTimbreInfo(cantonTimbreInfos);
List<TimbreInfo> enTimbreInfos = new ArrayList<>();
GetTimbreDto enDto = new GetTimbreDto();
enDto.setLanguage(2);
enDto.setMatchLang(MatchLangEnum.en.getMatchLang());
enDto.setTimbreInfo(enTimbreInfos);
for (BizVoiceTimbreEntity entity : entities) {
Integer language = entity.getLanguage();
......
......@@ -9,11 +9,24 @@ public class GetTimbreDto {
*/
private Integer language;
/**
* 匹配
*/
private String matchLang;
/**
* 音色信息
*/
private List<TimbreInfo> timbreInfo;
public String getMatchLang() {
return matchLang;
}
public void setMatchLang(String matchLang) {
this.matchLang = matchLang;
}
public Integer getLanguage() {
return language;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment