chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Embed i18n entry point.
|
||||
*
|
||||
* - Visitor UI strings: `frontend/src/i18n/embed.ts` (loaded by embed-main.ts)
|
||||
* - Admin `embedPublish` strings: `frontend/src/i18n/locales/*.ts`
|
||||
*
|
||||
* Re-export locale helpers so feature code can import from one path.
|
||||
*/
|
||||
export {
|
||||
applyEmbedLocale,
|
||||
EMBED_LOCALE_STORAGE_KEY,
|
||||
EMBED_MESSAGES,
|
||||
normalizeEmbedLocale,
|
||||
readEmbedLocaleFromUrl,
|
||||
SUPPORTED_LOCALES,
|
||||
syncEmbedLocaleFromUrl,
|
||||
type EmbedLocale,
|
||||
} from '@/i18n/embed'
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,57 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import enUS from './en-US.ts'
|
||||
import jaJP from './ja-JP.ts'
|
||||
import koKR from './ko-KR.ts'
|
||||
import ruRU from './ru-RU.ts'
|
||||
import zhCN from './zh-CN.ts'
|
||||
import zhTW from './zh-TW.ts'
|
||||
|
||||
type LocaleValue = string | Record<string, unknown> | unknown[]
|
||||
|
||||
function collectStrings(value: LocaleValue, path = ''): Array<{ path: string; value: string }> {
|
||||
if (typeof value === 'string') return [{ path, value }]
|
||||
if (Array.isArray(value)) {
|
||||
return value.flatMap((item, index) =>
|
||||
collectStrings(item as LocaleValue, `${path}[${index}]`),
|
||||
)
|
||||
}
|
||||
if (value && typeof value === 'object') {
|
||||
return Object.entries(value).flatMap(([key, item]) =>
|
||||
collectStrings(item as LocaleValue, path ? `${path}.${key}` : key),
|
||||
)
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
function withoutTechnicalTenantTokens(value: string): string {
|
||||
return value
|
||||
.replace(/\{tenant(?:Id)?\}/g, '')
|
||||
.replace(/\btenant_id\b/gi, '')
|
||||
.replace(/\btenantless\b/gi, '')
|
||||
.replace(/\bX-Tenant-ID\b/g, '')
|
||||
}
|
||||
|
||||
const localeChecks = [
|
||||
{ name: 'zh-CN', locale: zhCN, forbidden: /租户/ },
|
||||
{ name: 'zh-TW', locale: zhTW, forbidden: /租戶/ },
|
||||
{ name: 'en-US', locale: enUS, forbidden: /\btenants?\b/i },
|
||||
{ name: 'ko-KR', locale: koKR, forbidden: /테넌트/ },
|
||||
{ name: 'ja-JP', locale: jaJP, forbidden: /テナント/ },
|
||||
{ name: 'ru-RU', locale: ruRU, forbidden: /(?:тенант|арендатор)/i },
|
||||
]
|
||||
|
||||
test('user-facing locale values use workspace terminology', () => {
|
||||
for (const check of localeChecks) {
|
||||
const legacyValues = collectStrings(check.locale)
|
||||
.filter(({ value }) => check.forbidden.test(withoutTechnicalTenantTokens(value)))
|
||||
.map(({ path, value }) => `${check.name}:${path}=${value}`)
|
||||
|
||||
assert.deepEqual(
|
||||
legacyValues,
|
||||
[],
|
||||
`${check.name} still contains user-facing tenant terminology`,
|
||||
)
|
||||
}
|
||||
})
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user