Trim frontend build for lightweight AI agent admin
This commit is contained in:
@@ -30,66 +30,24 @@ const modules = import.meta.glob([
|
||||
'./langs/*/authentication.json',
|
||||
'./langs/*/chat.json',
|
||||
'./langs/*/common.json',
|
||||
'./langs/*/database-connection.json',
|
||||
'./langs/*/data-source.json',
|
||||
'./langs/*/dept.json',
|
||||
'./langs/*/dict.json',
|
||||
'./langs/*/file-manager.json',
|
||||
'./langs/*/loginLog.json',
|
||||
'./langs/*/menu.json',
|
||||
'./langs/*/menu-title.json',
|
||||
'./langs/*/message.json',
|
||||
'./langs/*/org-chart.json',
|
||||
'./langs/*/page.json',
|
||||
'./langs/*/permission.json',
|
||||
'./langs/*/post.json',
|
||||
'./langs/*/role.json',
|
||||
'./langs/*/server-monitor.json',
|
||||
'./langs/*/system-config.json',
|
||||
'./langs/*/system.json',
|
||||
'./langs/*/ui-config.json',
|
||||
'./langs/*/ui.json',
|
||||
'./langs/*/user-avatar.json',
|
||||
'./langs/*/user.json',
|
||||
'./langs/*/wiki.json',
|
||||
'./langs/*/workflow.json',
|
||||
'./langs/*/zq-smart-table.json',
|
||||
]);
|
||||
|
||||
const localesMap = loadLocalesMapFromDir(
|
||||
/\.\/langs\/([^/]+)\/(.*)\.json$/,
|
||||
modules,
|
||||
);
|
||||
/** zq-table 需要提升到根级的命名空间,以便 t('table.xxx') 等能正确解析 */
|
||||
const ZQ_TABLE_ROOT_KEYS = [
|
||||
'common',
|
||||
'table',
|
||||
'toolbar',
|
||||
'filter',
|
||||
'field',
|
||||
'view',
|
||||
'kanban',
|
||||
'gantt',
|
||||
'calendar',
|
||||
'gallery',
|
||||
'form',
|
||||
'dashboard',
|
||||
'sidebar',
|
||||
'app',
|
||||
'theme',
|
||||
'language',
|
||||
'link',
|
||||
'cellRenderer',
|
||||
'permission',
|
||||
'summary',
|
||||
'formula',
|
||||
'validation',
|
||||
'comment',
|
||||
'mention',
|
||||
'document',
|
||||
'trash',
|
||||
'version',
|
||||
'template',
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* 加载应用特有的语言包
|
||||
@@ -101,30 +59,7 @@ async function loadMessages(lang: SupportedLanguagesType) {
|
||||
localesMap[lang]?.(),
|
||||
loadThirdPartyMessage(lang),
|
||||
]);
|
||||
const messages = appLocaleMessages?.default || {};
|
||||
// 将 zq-table / zq-smart-table 的 table/toolbar/filter 等命名空间提升到根级
|
||||
// 使用浅合并:zq-table 的子键补充到已有命名空间,app 级别的同名 key 优先保留
|
||||
const merged = { ...messages };
|
||||
for (const ns of ['zq-table', 'zq-smart-table'] as const) {
|
||||
const src = messages[ns];
|
||||
if (src && typeof src === 'object') {
|
||||
for (const key of ZQ_TABLE_ROOT_KEYS) {
|
||||
if (key in src && src[key] != null) {
|
||||
const existing = merged[key];
|
||||
if (
|
||||
existing &&
|
||||
typeof existing === 'object' &&
|
||||
typeof src[key] === 'object'
|
||||
) {
|
||||
merged[key] = { ...src[key], ...existing };
|
||||
} else {
|
||||
merged[key] = src[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
return appLocaleMessages?.default || {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user