chore: vendor FBA UI 工程源码(fastapi-best-architecture-ui master,Epic #163 受控源码基础)

This commit is contained in:
2026-08-06 12:50:35 +08:00
parent 9728fa40fe
commit 88d84757ac
1166 changed files with 109805 additions and 0 deletions
@@ -0,0 +1,3 @@
# locale
每个app使用的国际化可能不同,这里用于扩展国际化的功能,例如扩展 dayjs、antd组件库的多语言切换,以及app本身的国际化文件。
@@ -0,0 +1,110 @@
import type { Locale } from 'antdv-next/dist/locale/index';
import type { App } from 'vue';
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { ref } from 'vue';
import {
$t,
setupI18n as coreSetup,
loadLocalesMapFromDir,
} from '@vben/locales';
import { preferences } from '@vben/preferences';
import antdEnLocale from 'antdv-next/dist/locale/en_US';
import antdDefaultLocale from 'antdv-next/dist/locale/zh_CN';
import dayjs from 'dayjs';
const antdLocale = ref<Locale>(antdDefaultLocale);
const modules = import.meta.glob('./langs/**/*.json');
const pluginModules = import.meta.glob('../plugins/**/langs/**/*.json');
const localesMap = loadLocalesMapFromDir(
/\.\/langs\/([^/]+)\/(.*)\.json$/,
modules,
);
const pluginLocalesMap = loadLocalesMapFromDir(
/\/plugins\/[^/]+\/langs\/([^/]+)\/([^/]+)\.json$/,
pluginModules,
);
/**
* 加载应用特有的语言包
* 这里也可以改造为从服务端获取翻译数据
* @param lang
*/
async function loadMessages(lang: SupportedLanguagesType) {
const [appLocaleMessages, pluginLocalMessages] = await Promise.all([
localesMap[lang]?.(),
pluginLocalesMap[lang]?.(),
loadThirdPartyMessage(lang),
]);
return { ...appLocaleMessages?.default, ...pluginLocalMessages?.default };
}
/**
* 加载第三方组件库的语言包
* @param lang
*/
async function loadThirdPartyMessage(lang: SupportedLanguagesType) {
await Promise.all([loadAntdLocale(lang), loadDayjsLocale(lang)]);
}
/**
* 加载dayjs的语言包
* @param lang
*/
async function loadDayjsLocale(lang: SupportedLanguagesType) {
let locale;
switch (lang) {
case 'en-US': {
locale = await import('dayjs/locale/en');
break;
}
case 'zh-CN': {
locale = await import('dayjs/locale/zh-cn');
break;
}
// 默认使用英语
default: {
locale = await import('dayjs/locale/en');
}
}
if (locale) {
dayjs.locale(locale);
} else {
console.error(`Failed to load dayjs locale for ${lang}`);
}
}
/**
* 加载antd的语言包
* @param lang
*/
async function loadAntdLocale(lang: SupportedLanguagesType) {
switch (lang) {
case 'en-US': {
antdLocale.value = antdEnLocale;
break;
}
case 'zh-CN': {
antdLocale.value = antdDefaultLocale;
break;
}
}
}
async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
await coreSetup(app, {
defaultLocale: preferences.app.locale,
loadMessages,
missingWarn: !import.meta.env.PROD,
...options,
});
}
export { $t, antdLocale, setupI18n };
@@ -0,0 +1,14 @@
{
"form": {
"query": "Query",
"select": "Please select",
"status": "Status"
},
"table": {
"created_time": "Created Time",
"id": "ID",
"mark": "Mark",
"operation": "Operation",
"updated_time": "Updated time"
}
}
@@ -0,0 +1,14 @@
{
"title": "Demos",
"antd": "Antdv Next",
"vben": {
"title": "Project",
"about": "About",
"document": "Document",
"antdv": "Ant Design Vue Version",
"antdv-next": "Antdv Next Version",
"naive-ui": "Naive UI Version",
"element-plus": "Element Plus Version",
"tdesign": "TDesign Vue Version"
}
}
@@ -0,0 +1,114 @@
{
"auth": {
"login": "Login",
"register": "Register",
"codeLogin": "Code Login",
"qrcodeLogin": "Qr Code Login",
"forgetPassword": "Forget Password",
"captchaPlaceholder": "Please enter the captcha",
"captchaRequired": "The captcha is required",
"profile": "Profile"
},
"dashboard": {
"title": "Dashboard",
"analytics": "Analytics",
"workspace": "Workspace"
},
"menu": {
"system": "System",
"scheduler": "Scheduler",
"schedulerManage": "Manage",
"schedulerRecord": "Record",
"log": "System Log",
"login": "Login",
"monitor": "System Monitor",
"opera": "Opera",
"online": "Online",
"redis": "Redis",
"server": "Server",
"sysDataPermission": "Data Permission",
"sysDataScope": "Data Scope",
"sysDataRule": "Data Rule",
"sysPlugin": "Plugin",
"sysDept": "Dept",
"sysMenu": "User",
"sysRole": "Role",
"sysUser": "User",
"profile": "Profile"
},
"monitor": {
"redis": {
"cards": {
"commands": {
"title": "Command Statistics"
},
"memory": {
"title": "Memory Status"
}
},
"info": {
"title": "Server Info",
"redis_version": "Version",
"redis_mode": "Mode",
"role": "Role",
"tcp_port": "TCP Port",
"uptime": "Uptime",
"connected_clients": "Connected Clients",
"blocked_clients": "Blocked Clients",
"used_memory_human": "Used Memory",
"used_memory_rss_human": "RSS Memory",
"maxmemory_human": "Max Memory",
"mem_fragmentation_ratio": "Fragmentation Ratio",
"total_commands_processed": "Commands Processed",
"instantaneous_ops_per_sec": "Ops/Sec",
"rejected_connections": "Rejected Connections",
"keys_num": "Keys"
}
},
"server": {
"cpu": {
"title": "CPU",
"current_freq": "Current Freq (MHz)",
"logical_num": "Logical Cores",
"physical_num": "Physical Cores",
"usage": "CPU Usage"
},
"disk": {
"title": "Disk",
"device": "Device",
"dir": "Mount Point",
"free": "Free",
"total": "Total",
"type": "Type",
"usage": "Usage",
"used": "Used"
},
"memory": {
"title": "Memory",
"free": "Free",
"total": "Total",
"usage": "Usage",
"used": "Used"
},
"service": {
"title": "Service Info",
"name": "Service Name",
"version": "Version",
"home": "Home Path",
"cpu_usage": "CPU Usage",
"mem_vms": "Virtual Memory",
"mem_rss": "Physical Memory",
"mem_free": "Free Memory",
"startup": "Startup Time",
"elapsed": "Elapsed Time"
},
"system": {
"title": "System Info",
"name": "Hostname",
"ip": "IP Address",
"os": "OS",
"arch": "Architecture"
}
}
}
}
@@ -0,0 +1,14 @@
{
"form": {
"query": "查询",
"select": "请选择",
"status": "状态"
},
"table": {
"created_time": "创建时间",
"id": "序号",
"mark": "备注",
"operation": "操作",
"updated_time": "更新时间"
}
}
@@ -0,0 +1,14 @@
{
"title": "演示",
"antd": "Antdv Next",
"vben": {
"title": "项目",
"about": "关于",
"document": "文档",
"antdv": "Ant Design Vue 版本",
"antdv-next": "Antdv Next 版本",
"naive-ui": "Naive UI 版本",
"element-plus": "Element Plus 版本",
"tdesign": "TDesign Vue 版本"
}
}
@@ -0,0 +1,114 @@
{
"auth": {
"login": "登录",
"register": "注册",
"codeLogin": "验证码登录",
"qrcodeLogin": "二维码登录",
"forgetPassword": "忘记密码",
"captchaPlaceholder": "请输入验证码",
"captchaRequired": "验证码是必须的",
"profile": "个人中心"
},
"dashboard": {
"title": "概览",
"analytics": "分析页",
"workspace": "工作台"
},
"menu": {
"system": "系统管理",
"scheduler": "任务调度",
"schedulerManage": "任务管理",
"schedulerRecord": "执行记录",
"log": "日志管理",
"login": "登录日志",
"monitor": "系统监控",
"opera": "操作日志",
"online": "在线用户",
"redis": "Redis",
"server": "服务器",
"sysDataPermission": "数据权限",
"sysDataScope": "数据范围",
"sysDataRule": "数据规则",
"sysPlugin": "插件管理",
"sysDept": "部门管理",
"sysMenu": "菜单管理",
"sysRole": "角色管理",
"sysUser": "用户管理",
"profile": "个人中心"
},
"monitor": {
"redis": {
"cards": {
"commands": {
"title": "命令统计"
},
"memory": {
"title": "内存使用"
}
},
"info": {
"title": "服务器信息",
"redis_version": "版本",
"redis_mode": "运行模式",
"role": "节点角色",
"tcp_port": "监听端口",
"uptime": "运行时长",
"connected_clients": "已连接客户端数",
"blocked_clients": "阻塞客户端数",
"used_memory_human": "已使用内存",
"used_memory_rss_human": "RSS 内存",
"maxmemory_human": "最大内存限制",
"mem_fragmentation_ratio": "内存碎片率",
"total_commands_processed": "命令处理总数",
"instantaneous_ops_per_sec": "每秒操作数",
"rejected_connections": "拒绝连接数",
"keys_num": "键总数"
}
},
"server": {
"cpu": {
"title": "CPU 信息",
"current_freq": "当前频率 (MHz)",
"logical_num": "逻辑核心数",
"physical_num": "物理核心数",
"usage": "CPU 使用率"
},
"disk": {
"title": "磁盘信息",
"device": "设备名称",
"dir": "挂载点",
"free": "可用",
"total": "总容量",
"type": "文件系统类型",
"usage": "使用率",
"used": "已使用"
},
"memory": {
"free": "可用",
"title": "内存信息",
"total": "总量",
"usage": "使用率",
"used": "已使用"
},
"service": {
"title": "服务信息",
"name": "服务名称",
"version": "版本",
"home": "安装路径",
"cpu_usage": "CPU 使用率",
"mem_vms": "虚拟内存",
"mem_rss": "物理内存",
"mem_free": "可用内存",
"startup": "启动时间",
"elapsed": "运行时长"
},
"system": {
"title": "系统信息",
"name": "主机名",
"ip": "IP 地址",
"os": "操作系统",
"arch": "系统架构"
}
}
}
}