@alauda/doom 0.18.11 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/load-config.js +10 -1
- package/lib/cli/translate.d.ts +6 -4
- package/lib/cli/translate.js +31 -18
- package/lib/runtime/components/_ExternalSiteBase.js +6 -0
- package/lib/runtime/hooks/useSiteOverrides.d.ts +3 -3
- package/lib/runtime/hooks/useSiteOverrides.js +7 -5
- package/lib/runtime/hooks/useTranslation.d.ts +2 -2
- package/lib/runtime/hooks/useTranslation.js +3 -3
- package/lib/runtime/translation.d.ts +38 -1
- package/lib/runtime/translation.js +19 -1
- package/lib/shared/constants.d.ts +7 -0
- package/lib/shared/constants.js +6 -0
- package/lib/terms.d.ts +3 -1
- package/package.json +9 -9
package/lib/cli/load-config.js
CHANGED
|
@@ -19,6 +19,14 @@ const zhLocaleConfig = {
|
|
|
19
19
|
prevPageText: '上一页',
|
|
20
20
|
nextPageText: '下一页',
|
|
21
21
|
};
|
|
22
|
+
const ruLocaleConfig = {
|
|
23
|
+
searchPlaceholderText: 'Поиск документов',
|
|
24
|
+
searchNoResultsText: 'Не найдено соответствующих результатов',
|
|
25
|
+
searchSuggestedQueryText: 'Попробуйте изменить ключевые слова и повторить поиск',
|
|
26
|
+
outlineTitle: 'Обзор страницы',
|
|
27
|
+
prevPageText: 'Предыдущая страница',
|
|
28
|
+
nextPageText: 'Следующая страница',
|
|
29
|
+
};
|
|
22
30
|
const getCommonConfig = ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, }) => {
|
|
23
31
|
const fallbackToZh = 'lang' in config && !config.lang;
|
|
24
32
|
root = resolveDocRoot(CWD, root, config.root);
|
|
@@ -60,8 +68,9 @@ const getCommonConfig = ({ config, root, configFilePath, base, version, download
|
|
|
60
68
|
? zhLocaleConfig
|
|
61
69
|
: {
|
|
62
70
|
locales: [
|
|
63
|
-
{ lang: 'zh', label: '简体中文', ...zhLocaleConfig },
|
|
64
71
|
{ lang: 'en', label: 'English' },
|
|
72
|
+
{ lang: 'zh', label: '简体中文', ...zhLocaleConfig },
|
|
73
|
+
{ lang: 'ru', label: 'Русский', ...ruLocaleConfig },
|
|
65
74
|
],
|
|
66
75
|
}),
|
|
67
76
|
},
|
package/lib/cli/translate.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { Language } from '../shared/index.js';
|
|
2
3
|
import type { TranslateOptions } from '../types.js';
|
|
3
4
|
export interface I18nFrontmatter {
|
|
4
5
|
i18n?: {
|
|
@@ -9,17 +10,18 @@ export interface I18nFrontmatter {
|
|
|
9
10
|
sourceSHA?: string;
|
|
10
11
|
title?: string;
|
|
11
12
|
}
|
|
13
|
+
export declare const TERMS_SUPPORTED_LANGUAGES: Language[];
|
|
12
14
|
export interface InternalTranslateOptions extends TranslateOptions {
|
|
13
|
-
source:
|
|
15
|
+
source: Language;
|
|
14
16
|
sourceContent: string;
|
|
15
|
-
target:
|
|
17
|
+
target: Language;
|
|
16
18
|
targetContent?: string;
|
|
17
19
|
additionalPrompts?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare const translate: ({ source, sourceContent, target, targetContent, systemPrompt, userPrompt, additionalPrompts, }: InternalTranslateOptions) => Promise<string>;
|
|
20
22
|
export interface TranslateCommandOptions {
|
|
21
|
-
source:
|
|
22
|
-
target:
|
|
23
|
+
source: Language;
|
|
24
|
+
target: Language;
|
|
23
25
|
glob: string[];
|
|
24
26
|
copy?: boolean;
|
|
25
27
|
}
|
package/lib/cli/translate.js
CHANGED
|
@@ -16,13 +16,11 @@ import { fetchApi } from 'x-fetch';
|
|
|
16
16
|
import { parse } from 'yaml';
|
|
17
17
|
import { cyan, red } from 'yoctocolors';
|
|
18
18
|
import { mdProcessor, mdxProcessor, normalizeImgSrc, } from '../plugins/index.js';
|
|
19
|
+
import { Language, SUPPORTED_LANGUAGES } from '../shared/index.js';
|
|
19
20
|
import { pathExists } from '../utils/index.js';
|
|
20
21
|
import { escapeMarkdownHeadingIds, getMatchedDocFilePaths, parseBoolean, } from './helpers.js';
|
|
21
22
|
import { loadConfig } from './load-config.js';
|
|
22
|
-
const
|
|
23
|
-
zh: '中文',
|
|
24
|
-
en: '英文',
|
|
25
|
-
};
|
|
23
|
+
export const TERMS_SUPPORTED_LANGUAGES = ['en', 'zh'];
|
|
26
24
|
const DEFAULT_SYSTEM_PROMPT = `
|
|
27
25
|
## 角色
|
|
28
26
|
你是一位专业的技术文档工程师,擅长写作高质量的<%= targetLang %>技术分档。请你帮我准确地将以下<%= sourceLang %>翻译成<%= targetLang %>,风格与<%= targetLang %>技术文档保持一致。
|
|
@@ -31,9 +29,9 @@ const DEFAULT_SYSTEM_PROMPT = `
|
|
|
31
29
|
- 第一条消息为需要翻译的最新<%= sourceLang %>文档,第二条消息为之前翻译过的但内容可能过期的<%= targetLang %>文档,如果没有翻译过则为空
|
|
32
30
|
- 输入格式为 MDX 格式,输出格式也必须保留原始 MDX 格式,不要翻译其中的 jsx 组件名称,如 <Overview />,且不要额外包装在不必要的代码块中
|
|
33
31
|
- 文档中的资源链接不要翻译和替换
|
|
34
|
-
- MDX 组件中包含的内容需要翻译,MDX
|
|
35
|
-
|
|
36
|
-
-
|
|
32
|
+
- MDX 组件中包含的内容需要翻译,MDX 组件名和参数值不需要翻译,但特殊的 MDX 组件参数值需要翻译,示例:
|
|
33
|
+
- <Overview /> 中的 Overview 是组件名,不用翻译
|
|
34
|
+
- <Tab label="value">组件包含的内容</Tab>,label 是 key 不用翻译,"value" 是参数值需要翻译
|
|
37
35
|
<%= terms %>
|
|
38
36
|
- 如果存在下列注释,请保留不用翻译,更不要修改注释内容
|
|
39
37
|
- {/* release-notes-for-bugs */}
|
|
@@ -63,10 +61,21 @@ const DEFAULT_SYSTEM_PROMPT = `
|
|
|
63
61
|
<%= additionalPrompts %>
|
|
64
62
|
`.trim();
|
|
65
63
|
let openai;
|
|
66
|
-
const
|
|
64
|
+
const resolveTerms_ = async () => {
|
|
67
65
|
const terms = await fetchApi('https://gitlab-ce.alauda.cn/alauda-public/product-doc-guide/-/raw/main/terms.yaml', { type: 'text' });
|
|
68
66
|
const parsedTerms = parse(terms);
|
|
69
|
-
return
|
|
67
|
+
return ('- 以下是常见的相关术语词汇对应表(English -> 中文)\n' +
|
|
68
|
+
parsedTerms.map(({ en, zh = en }) => ` * ${en} -> ${zh}`).join('\n'));
|
|
69
|
+
};
|
|
70
|
+
let termsCache;
|
|
71
|
+
const resolveTerms = async () => {
|
|
72
|
+
if (termsCache) {
|
|
73
|
+
return termsCache;
|
|
74
|
+
}
|
|
75
|
+
return (termsCache = resolveTerms_().then((terms) => {
|
|
76
|
+
logger.debug('Resolved terms:', terms);
|
|
77
|
+
return terms;
|
|
78
|
+
}));
|
|
70
79
|
};
|
|
71
80
|
export const translate = async ({ source, sourceContent, target, targetContent = '', systemPrompt, userPrompt = '', additionalPrompts = '', }) => {
|
|
72
81
|
if (!openai) {
|
|
@@ -77,15 +86,18 @@ export const translate = async ({ source, sourceContent, target, targetContent =
|
|
|
77
86
|
apiVersion: process.env.OPENAI_API_VERSION || '2025-03-01-preview',
|
|
78
87
|
});
|
|
79
88
|
}
|
|
80
|
-
const sourceLang =
|
|
81
|
-
const targetLang =
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const sourceLang = Language[source];
|
|
90
|
+
const targetLang = Language[target];
|
|
91
|
+
let terms = '';
|
|
92
|
+
if ([source, target].every((lang) => TERMS_SUPPORTED_LANGUAGES.includes(lang))) {
|
|
93
|
+
terms = await resolveTerms();
|
|
94
|
+
}
|
|
95
|
+
const finalSystemPrompt = await render(systemPrompt?.trim() || DEFAULT_SYSTEM_PROMPT, { sourceLang, targetLang, userPrompt, additionalPrompts, terms }, { async: true });
|
|
84
96
|
const { choices } = await openai.beta.chat.completions.parse({
|
|
85
97
|
messages: [
|
|
86
98
|
{
|
|
87
99
|
role: 'system',
|
|
88
|
-
content:
|
|
100
|
+
content: finalSystemPrompt,
|
|
89
101
|
},
|
|
90
102
|
{
|
|
91
103
|
role: 'user',
|
|
@@ -109,17 +121,18 @@ const limit = pRateLimit({
|
|
|
109
121
|
rate: 50,
|
|
110
122
|
concurrency: 10,
|
|
111
123
|
});
|
|
124
|
+
const supportedLanguages = SUPPORTED_LANGUAGES.join(', ');
|
|
112
125
|
export const translateCommand = new Command('translate')
|
|
113
126
|
.description('Translate the documentation')
|
|
114
127
|
.argument('[root]', 'Root directory of the documentation')
|
|
115
|
-
.option('-s, --source <language>',
|
|
116
|
-
.option('-t, --target <language>',
|
|
128
|
+
.option('-s, --source <language>', `Document source language, one of ${supportedLanguages}`, 'en')
|
|
129
|
+
.option('-t, --target <language>', `Document target language, one of ${supportedLanguages}`, 'zh')
|
|
117
130
|
.requiredOption('-g, --glob <path...>', 'Glob patterns for source dirs/files')
|
|
118
131
|
.option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', parseBoolean, false)
|
|
119
132
|
.action(async function (root) {
|
|
120
133
|
const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
|
|
121
|
-
if (!Object.hasOwn(
|
|
122
|
-
!Object.hasOwn(
|
|
134
|
+
if (!Object.hasOwn(Language, source) ||
|
|
135
|
+
!Object.hasOwn(Language, target) ||
|
|
123
136
|
source === target) {
|
|
124
137
|
logger.error(`Translate from language \`${cyan(source)}\` to \`${cyan(target)}\` is not supported.`);
|
|
125
138
|
process.exitCode = 1;
|
|
@@ -13,6 +13,9 @@ const SiteNotes = {
|
|
|
13
13
|
const displayName_ = handleCJKWhitespaces(displayName);
|
|
14
14
|
return (_jsxs(_Fragment, { children: ["\u56E0\u4E3A", displayName_, "\u7684\u53D1\u7248\u5468\u671F\u4E0E\u7075\u96C0\u4E91\u5BB9\u5668\u5E73\u53F0\u4E0D\u540C\uFF0C\u6240\u4EE5", displayName_, "\u7684\u6587\u6863\u73B0\u5728\u4F5C\u4E3A\u72EC\u7ACB\u7684\u6587\u6863\u7AD9\u70B9\u6258\u7BA1\u5728", displayName_.startsWith(' ') ? ' ' : '', _jsx(ExternalSiteLink, { name: name, children: displayName }), "\u3002"] }));
|
|
15
15
|
},
|
|
16
|
+
ru({ name, displayName }) {
|
|
17
|
+
return (_jsxs(_Fragment, { children: ["\u041F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443 \u0432\u044B\u043F\u0443\u0441\u043A\u0438 ", displayName, " \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u044E\u0442\u0441\u044F \u0432 \u0438\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435, \u0447\u0435\u043C \u0443 Alauda Container Platform, \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F ", displayName, " \u0442\u0435\u043F\u0435\u0440\u044C \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u043D\u0430\u0431\u043E\u0440\u0430 \u043F\u043E \u0430\u0434\u0440\u0435\u0441\u0443", ' ', _jsx(ExternalSiteLink, { name: name, children: displayName }), "\u3002"] }));
|
|
18
|
+
},
|
|
16
19
|
};
|
|
17
20
|
const ApisOverviewNotes = {
|
|
18
21
|
en({ name, displayName }) {
|
|
@@ -22,6 +25,9 @@ const ApisOverviewNotes = {
|
|
|
22
25
|
const displayName_ = handleCJKWhitespaces(displayName);
|
|
23
26
|
return (_jsxs(_Fragment, { children: ["\u5173\u4E8E", displayName_, " APIs \u7684\u4F7F\u7528\u65B9\u6CD5\u4ECB\u7ECD\u8BF7\u53C2\u8003", displayName_.startsWith(' ') ? ' ' : '', _jsxs(ExternalSiteLink, { name: name, href: "apis/overview/", children: [displayName, " APIs \u6307\u5357"] }), "\u3002"] }));
|
|
24
27
|
},
|
|
28
|
+
ru({ name, displayName }) {
|
|
29
|
+
return (_jsxs(_Fragment, { children: ["\u0414\u043B\u044F \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D\u0438\u044F \u0441 \u043C\u0435\u0442\u043E\u0434\u0430\u043C\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F API ", displayName, ", \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438", ' ', _jsxs(ExternalSiteLink, { name: name, href: "apis/overview/", children: [displayName, " APIs Guide"] }), "."] }));
|
|
30
|
+
},
|
|
25
31
|
};
|
|
26
32
|
export const ExternalSiteBase = ({ name, template }) => {
|
|
27
33
|
const site = useMemo(() => virtual.sites?.find((s) => s.name === name), []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Language } from '../../shared/index.js';
|
|
1
2
|
import { type NamedTerms, type TermName } from '../../terms.js';
|
|
2
|
-
import type { Locale } from '../translation.js';
|
|
3
3
|
export type SiteOverridesTerms = Record<TermName, string>;
|
|
4
4
|
export interface SiteOverridesItem {
|
|
5
5
|
title?: string;
|
|
@@ -7,9 +7,9 @@ export interface SiteOverridesItem {
|
|
|
7
7
|
terms?: SiteOverridesTerms;
|
|
8
8
|
}
|
|
9
9
|
export type SiteOverrides = {
|
|
10
|
-
[K in Exclude<keyof SiteOverridesItem, 'terms'>]?: Partial<Record<
|
|
10
|
+
[K in Exclude<keyof SiteOverridesItem, 'terms'>]?: Partial<Record<Language, SiteOverridesItem[K]>>;
|
|
11
11
|
} & {
|
|
12
12
|
terms?: NamedTerms;
|
|
13
13
|
};
|
|
14
|
-
export type NormalizedSiteOverrides = Record<
|
|
14
|
+
export type NormalizedSiteOverrides = Record<Language, SiteOverridesItem>;
|
|
15
15
|
export declare const useSiteOverrides: () => SiteOverridesItem;
|
|
@@ -4,17 +4,18 @@ import { merge } from 'es-toolkit/compat';
|
|
|
4
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { parse } from 'yaml';
|
|
6
6
|
import { namedTerms } from '../../terms.js';
|
|
7
|
-
import {
|
|
7
|
+
import { useLang } from './useTranslation.js';
|
|
8
8
|
const normalizeOverrides = (origin) => Object.keys(origin).reduce((acc, key_) => {
|
|
9
9
|
const key = key_;
|
|
10
10
|
const term = origin[key];
|
|
11
11
|
if (!term) {
|
|
12
12
|
return acc;
|
|
13
13
|
}
|
|
14
|
-
acc.en[key] = term.en;
|
|
15
|
-
acc.zh[key] = term.zh ||
|
|
14
|
+
const en = (acc.en[key] = term.en);
|
|
15
|
+
acc.zh[key] = term.zh || en;
|
|
16
|
+
acc.ru[key] = term.ru || en;
|
|
16
17
|
return acc;
|
|
17
|
-
}, { en: {}, zh: {} });
|
|
18
|
+
}, { en: {}, zh: {}, ru: {} });
|
|
18
19
|
let normalizedSiteOverrides;
|
|
19
20
|
let promise;
|
|
20
21
|
const fetchSiteOverrides = async (base, version, acpSite) => {
|
|
@@ -55,13 +56,14 @@ const fetchSiteOverrides = async (base, version, acpSite) => {
|
|
|
55
56
|
return {
|
|
56
57
|
en: { ...normalizedSiteOverrides.en, terms: normalizedTerms.en },
|
|
57
58
|
zh: { ...normalizedSiteOverrides.zh, terms: normalizedTerms.zh },
|
|
59
|
+
ru: { ...normalizedSiteOverrides.ru, terms: normalizedTerms.ru },
|
|
58
60
|
};
|
|
59
61
|
}));
|
|
60
62
|
};
|
|
61
63
|
export const useSiteOverrides = () => {
|
|
62
64
|
const { siteData } = usePageData();
|
|
63
65
|
const [siteOverrides, setSiteOverrides] = useState(normalizedSiteOverrides);
|
|
64
|
-
const lang =
|
|
66
|
+
const lang = useLang();
|
|
65
67
|
const acpSite = useMemo(() => virtual.sites?.find((s) => s.name === 'acp'), []);
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
if (normalizedSiteOverrides) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { Language } from '../../shared/index.js';
|
|
2
|
+
export declare const useLang: () => Language;
|
|
3
3
|
export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "create" | "update" | "view" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf") => string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useLang } from '@rspress/core/runtime';
|
|
1
|
+
import { useLang as useLang_ } from '@rspress/core/runtime';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { TRANSLATIONS } from '../translation.js';
|
|
4
|
-
export const
|
|
4
|
+
export const useLang = () => useLang_();
|
|
5
5
|
export const useTranslation = () => {
|
|
6
|
-
const lang =
|
|
6
|
+
const lang = useLang();
|
|
7
7
|
const translations = TRANSLATIONS[lang];
|
|
8
8
|
return useCallback((key) => translations[key], [translations]);
|
|
9
9
|
};
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
declare const en: {
|
|
2
|
+
collapse_all: string;
|
|
3
|
+
expand_all: string;
|
|
4
|
+
crd_no_schema: string;
|
|
5
|
+
function: string;
|
|
6
|
+
action: string;
|
|
7
|
+
view: string;
|
|
8
|
+
create: string;
|
|
9
|
+
update: string;
|
|
10
|
+
delete: string;
|
|
11
|
+
name: string;
|
|
12
|
+
chinese: string;
|
|
13
|
+
english: string;
|
|
14
|
+
description: string;
|
|
15
|
+
chinese_bad_cases: string;
|
|
16
|
+
english_bad_cases: string;
|
|
17
|
+
download_pdf: string;
|
|
18
|
+
};
|
|
19
|
+
export type Translation = typeof en;
|
|
1
20
|
export declare const TRANSLATIONS: {
|
|
2
21
|
en: {
|
|
3
22
|
collapse_all: string;
|
|
@@ -35,5 +54,23 @@ export declare const TRANSLATIONS: {
|
|
|
35
54
|
english_bad_cases: string;
|
|
36
55
|
download_pdf: string;
|
|
37
56
|
};
|
|
57
|
+
ru: {
|
|
58
|
+
collapse_all: string;
|
|
59
|
+
expand_all: string;
|
|
60
|
+
crd_no_schema: string;
|
|
61
|
+
function: string;
|
|
62
|
+
action: string;
|
|
63
|
+
view: string;
|
|
64
|
+
create: string;
|
|
65
|
+
update: string;
|
|
66
|
+
delete: string;
|
|
67
|
+
name: string;
|
|
68
|
+
chinese: string;
|
|
69
|
+
english: string;
|
|
70
|
+
description: string;
|
|
71
|
+
chinese_bad_cases: string;
|
|
72
|
+
english_bad_cases: string;
|
|
73
|
+
download_pdf: string;
|
|
74
|
+
};
|
|
38
75
|
};
|
|
39
|
-
export
|
|
76
|
+
export {};
|
|
@@ -34,4 +34,22 @@ const zh = {
|
|
|
34
34
|
english_bad_cases: '英文反例',
|
|
35
35
|
download_pdf: '下载 PDF',
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
const ru = {
|
|
38
|
+
collapse_all: 'Свернуть всё',
|
|
39
|
+
expand_all: 'Развернуть всё',
|
|
40
|
+
crd_no_schema: 'Этот CRD имеет пустую или не указанную схему.',
|
|
41
|
+
function: 'Функция',
|
|
42
|
+
action: 'Действие',
|
|
43
|
+
view: 'Просмотр',
|
|
44
|
+
create: 'Создать',
|
|
45
|
+
update: 'Обновить',
|
|
46
|
+
delete: 'Удалить',
|
|
47
|
+
name: 'Название',
|
|
48
|
+
chinese: 'Китайский',
|
|
49
|
+
english: 'Английский',
|
|
50
|
+
description: 'Описание',
|
|
51
|
+
chinese_bad_cases: 'Примеры ошибок на китайском',
|
|
52
|
+
english_bad_cases: 'Примеры ошибок на английском',
|
|
53
|
+
download_pdf: 'Скачать PDF',
|
|
54
|
+
};
|
|
55
|
+
export const TRANSLATIONS = { en, zh, ru };
|
|
@@ -2,3 +2,10 @@ export declare const ACP_BASE = "/container_platform/";
|
|
|
2
2
|
export declare const FALSY_VALUES: Set<string>;
|
|
3
3
|
export declare const JS_STR_FALSY_VALUES: Set<string>;
|
|
4
4
|
export declare const APIS_ROUTES: Set<string>;
|
|
5
|
+
export declare const Language: {
|
|
6
|
+
readonly en: "英文";
|
|
7
|
+
readonly zh: "中文";
|
|
8
|
+
readonly ru: "俄文";
|
|
9
|
+
};
|
|
10
|
+
export type Language = keyof typeof Language;
|
|
11
|
+
export declare const SUPPORTED_LANGUAGES: Language[];
|
package/lib/shared/constants.js
CHANGED
|
@@ -8,3 +8,9 @@ export const JS_STR_FALSY_VALUES = new Set([
|
|
|
8
8
|
'undefined',
|
|
9
9
|
]);
|
|
10
10
|
export const APIS_ROUTES = new Set(['apis/**', '*/apis/**']);
|
|
11
|
+
export const Language = {
|
|
12
|
+
en: '英文',
|
|
13
|
+
zh: '中文',
|
|
14
|
+
ru: '俄文',
|
|
15
|
+
};
|
|
16
|
+
export const SUPPORTED_LANGUAGES = Object.keys(Language);
|
package/lib/terms.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import type { SetOptional } from 'type-fest';
|
|
|
2
2
|
export interface TermItem {
|
|
3
3
|
en: string;
|
|
4
4
|
zh?: string;
|
|
5
|
+
ru?: string;
|
|
5
6
|
description?: string;
|
|
6
7
|
badCases?: {
|
|
7
|
-
zh?: string[];
|
|
8
8
|
en?: string[];
|
|
9
|
+
zh?: string[];
|
|
10
|
+
ru?: string[];
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
declare const terms: {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",
|
|
7
|
-
"packageManager": "yarn@4.
|
|
7
|
+
"packageManager": "yarn@4.9.1",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18.17.0 <20 || >=20.1.0"
|
|
10
10
|
},
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
46
46
|
"@playwright/browser-chromium": "^1.51.1",
|
|
47
47
|
"@rsbuild/plugin-yaml": "^1.0.2",
|
|
48
|
-
"@rspress/core": "1.43.
|
|
49
|
-
"@shikijs/transformers": "^3.2.
|
|
48
|
+
"@rspress/core": "1.43.11",
|
|
49
|
+
"@shikijs/transformers": "^3.2.2",
|
|
50
50
|
"chokidar": "^4.0.3",
|
|
51
51
|
"cli-progress": "^3.12.0",
|
|
52
52
|
"clsx": "^2.1.1",
|
|
@@ -67,18 +67,19 @@
|
|
|
67
67
|
"remark-directive": "^2.0.1",
|
|
68
68
|
"remark-frontmatter": "^4.0.1",
|
|
69
69
|
"remark-gfm": "^3.0.1",
|
|
70
|
-
"shiki": "^3.2.
|
|
70
|
+
"shiki": "^3.2.2",
|
|
71
71
|
"simple-git": "^3.27.0",
|
|
72
72
|
"swagger2openapi": "^7.0.8",
|
|
73
73
|
"tinyglobby": "^0.2.12",
|
|
74
74
|
"type-fest": "^4.39.1",
|
|
75
|
+
"x-fetch": "^0.2.6",
|
|
75
76
|
"yaml": "^2.7.1",
|
|
76
77
|
"yoctocolors": "^2.1.1"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"@eslint/js": "^9.24.0",
|
|
80
81
|
"@swc-node/register": "^1.10.10",
|
|
81
|
-
"@swc/core": "1.11.
|
|
82
|
+
"@swc/core": "1.11.21",
|
|
82
83
|
"@types/cli-progress": "^3.11.6",
|
|
83
84
|
"@types/ejs": "^3.1.5",
|
|
84
85
|
"@types/node": "^18.19.86",
|
|
@@ -89,15 +90,14 @@
|
|
|
89
90
|
"@unts/patch-package": "^8.1.1",
|
|
90
91
|
"eslint": "^9.24.0",
|
|
91
92
|
"eslint-import-resolver-typescript": "^4.3.2",
|
|
92
|
-
"eslint-plugin-import-x": "^4.10.
|
|
93
|
-
"
|
|
93
|
+
"eslint-plugin-import-x": "^4.10.3",
|
|
94
|
+
"nano-staged": "^0.8.0",
|
|
94
95
|
"npm-run-all2": "^7.0.2",
|
|
95
96
|
"prettier": "^3.5.3",
|
|
96
97
|
"prettier-plugin-pkg": "^0.19.0",
|
|
97
98
|
"simple-git-hooks": "^2.12.1",
|
|
98
99
|
"typescript": "^5.8.3",
|
|
99
100
|
"typescript-eslint": "^8.29.1",
|
|
100
|
-
"x-fetch": "^0.2.4",
|
|
101
101
|
"yarn-berry-deduplicate": "^6.1.1"
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|