20260727225141
This commit is contained in:
1 parent
9dbaef7787
commit
63588bd217
97 files changed
+1309
-145
No files matched your search
@@ -6,6 +6,18 @@ export const I18N_LOCALES = [
|
||||
|
||||
export const I18N_LOCALE_CODES = I18N_LOCALES.map((item) => item.value);
|
||||
|
||||
// 与数据库 s_module 的 CHECK 约束 CK_s_module_code 保持一致:
|
||||
// 长度 2-50,以小写字母开头,仅含小写字母/数字/下划线。
|
||||
export function validateModuleCode(code) {
|
||||
const value = String(code ?? "").trim();
|
||||
if (!value) return "编码不能为空";
|
||||
if (value.length < 2 || value.length > 50) return "编码长度需为 2-50 个字符";
|
||||
if (!/^[a-z][a-z0-9_]*$/.test(value)) {
|
||||
return "编码须以小写字母开头,且只能包含小写字母、数字和下划线";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
export function getI18nNamespace(key) {
|
||||
return String(key || "").split(".", 1)[0] || "common";
|
||||
}
|
||||
@@ -22,6 +34,13 @@ export function buildModuleItemI18nKey(prefix, moduleCode, itemCode) {
|
||||
: null;
|
||||
}
|
||||
|
||||
export function buildModuleI18nKey(moduleType, moduleCode) {
|
||||
const normalizedModuleCode = String(moduleCode || "").trim();
|
||||
if (!normalizedModuleCode) return null;
|
||||
const prefix = moduleType === "data" ? "module" : "menu";
|
||||
return `${prefix}.${normalizedModuleCode}`;
|
||||
}
|
||||
|
||||
export function syncModuleItemI18nKeys(rows, prefix, moduleCode, codeField) {
|
||||
let changed = false;
|
||||
for (const row of rows || []) {
|
||||
|
||||
Reference in new issue
Block a user