多语言方案已优化,成功解决 APP 端 Method too large 的问题,cool-ui 语言包现已独立分离
This commit is contained in:
2178
locale/en.json
Normal file
2178
locale/en.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2178
locale/es.json
Normal file
2178
locale/es.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2178
locale/fr.json
Normal file
2178
locale/fr.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,31 @@
|
||||
import { isNull, forInObject, isEmpty, storage, router } from "@/cool";
|
||||
import { ref } from "vue";
|
||||
import { zhcn } from "./zh-cn";
|
||||
import { en } from "./en";
|
||||
import { es } from "./es";
|
||||
import zhcn from "./zh-cn.json";
|
||||
import zhtw from "./zh-tw.json";
|
||||
import en from "./en.json";
|
||||
import es from "./es.json";
|
||||
import ja from "./ja.json";
|
||||
import ko from "./ko.json";
|
||||
import fr from "./fr.json";
|
||||
import { config } from "@/config";
|
||||
|
||||
// 语言包对象,包含所有支持的语言
|
||||
// 解析语言包
|
||||
function parse(val: string[][]) {
|
||||
return val[0][0].split("<__&__>").map((e) => e.split("<__=__>"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 语言包映射对象,包含所有已支持的语言。
|
||||
* 如需新增语言,只需新建对应的 xx.json 文件并在此处引入即可。
|
||||
*/
|
||||
const messages = {
|
||||
"zh-cn": zhcn,
|
||||
en,
|
||||
es
|
||||
"zh-cn": parse(zhcn),
|
||||
"zh-tw": parse(zhtw),
|
||||
en: parse(en),
|
||||
es: parse(es),
|
||||
ja: parse(ja),
|
||||
ko: parse(ko),
|
||||
fr: parse(fr)
|
||||
};
|
||||
|
||||
// 当前语言,默认中文
|
||||
|
||||
2178
locale/ja.json
Normal file
2178
locale/ja.json
Normal file
File diff suppressed because it is too large
Load Diff
2178
locale/ko.json
Normal file
2178
locale/ko.json
Normal file
File diff suppressed because it is too large
Load Diff
2178
locale/zh-cn.json
Normal file
2178
locale/zh-cn.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2178
locale/zh-tw.json
Normal file
2178
locale/zh-tw.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user