新增翻译模块:支持200多语言翻译

This commit is contained in:
dengwenjie
2025-06-17 11:03:34 +08:00
parent 6f66d8d19e
commit f7a59cc3aa
30 changed files with 661 additions and 1206 deletions

View File

@@ -0,0 +1,23 @@
package cn.smartjavaai.translation.enums;
/**
* 机器翻译模型枚举
* @author lwx
* @date 2025/6/05
*/
public enum TranslationModeEnum {
NLLB_MODEL;
/**
* 根据名称获取枚举 (忽略大小写和下划线变体)
*/
public static TranslationModeEnum fromName(String name) {
String formatted = name.trim().toUpperCase().replaceAll("[-_]", "");
for (TranslationModeEnum model : values()) {
if (model.name().replaceAll("_", "").equals(formatted)) {
return model;
}
}
throw new IllegalArgumentException("未知模型名称: " + name);
}
}