Repository navigation
Expand file tree
/
Copy pathconfig.js
More file actions
258 lines (250 loc) · 10.2 KB
/
Copy pathconfig.js
File metadata and controls
258 lines (250 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// Configuration of the i18n tooling (scripts/i18n): which locales are
// translated, from which source sets, where the string files live, and how
// the pre-commit hook and the headless translator behave. Config, not code.
// The site's locale list itself (URLs, labels) is i18nConfig in
// docusaurus.config.js; a locale must be in both to be built and translated.
module.exports = {
defaultLocale: 'en',
i18nDir: 'i18n',
manifest: 'i18n/manifest.json',
glossary: 'i18n/glossary.md',
// Source sets: a site directory and where its translations live under
// i18n/<locale>/ (the Docusaurus layout: <plugin name>[-<instance id>]).
// Only files with one of `extensions` are translated; everything else in
// a source directory (images, _category_.yml) is shared by every locale.
sources: {
docs: {
dir: 'docs',
target: 'docusaurus-plugin-content-docs/current',
},
'ai-content': {
dir: 'ai-content',
target: 'docusaurus-plugin-content-docs-ai/current',
},
'blog-product': {
dir: 'blog/product',
target: 'docusaurus-plugin-content-blog-product',
},
'blog-providers': {
dir: 'blog/providers',
target: 'docusaurus-plugin-content-blog-providers',
},
'blog-tutorials': {
dir: 'blog/tutorials',
target: 'docusaurus-plugin-content-blog-tutorials',
},
pages: {
dir: 'src/pages',
target: 'docusaurus-plugin-content-pages',
},
},
extensions: ['.md', '.mdx'],
// Per locale, the source sets that are translated. A source set not
// listed for a locale is served in English at the localized URL and
// marked noindex by the theme wrappers (src/theme/DocItem/Content,
// src/theme/BlogPostPage, src/theme/BlogListPage). The AI Reference
// (ai-content) is meant for answer engines, whose crawlers read English
// and Chinese, so it is translated for zh-Hans only.
// `sameAsEnglish` lists string keys whose English message is also the
// correct rendering in that locale (product and vendor names), so
// yarn i18n:strings does not report them as untranslated.
locales: {
de: {
sources: ['docs'],
sameAsEnglish: [
'item.label.Blog',
'item.label.Tutorials',
'link.title.StackQL',
'link.item.label.Blog',
'link.item.label.Support',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.Hash',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
es: {
sources: ['docs'],
sameAsEnglish: [
'item.label.Providers',
'item.label.Blog',
'link.title.StackQL',
'link.item.label.Providers',
'link.item.label.Blog',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.General',
'sidebar.docsSidebar.category.Hash',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
fr: {
sources: ['docs'],
sameAsEnglish: [
'item.label.Providers',
'item.label.Blog',
'link.title.StackQL',
'link.item.label.Documentation',
'link.item.label.Providers',
'link.item.label.Blog',
'link.item.label.Support',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.Session',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
id: {
sources: ['docs'],
sameAsEnglish: [
'item.label.Blog',
'link.title.StackQL',
'link.item.label.Blog',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.Hash',
'sidebar.docsSidebar.category.String',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
ja: {
sources: ['docs'],
sameAsEnglish: [
'link.title.StackQL',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
ko: {
sources: ['docs'],
sameAsEnglish: [
'link.title.StackQL',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
'pt-BR': {
sources: ['docs'],
sameAsEnglish: [
'item.label.Providers',
'item.label.Blog',
'link.title.StackQL',
'link.item.label.Providers',
'link.item.label.Blog',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.Hash',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
vi: {
sources: ['docs'],
sameAsEnglish: [
'item.label.Blog',
'link.title.StackQL',
'link.item.label.Blog',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
'zh-Hans': {
sources: ['docs', 'ai-content'],
sameAsEnglish: [
'link.title.StackQL',
'sidebar.docsSidebar.category.MCP',
'sidebar.docsSidebar.category.AWS',
'sidebar.docsSidebar.category.Microsoft Azure',
'sidebar.docsSidebar.category.Google Cloud Platform',
'sidebar.docsSidebar.category.GitHub',
],
},
},
// String files written by `docusaurus write-translations --locale <l>`
// (yarn i18n:strings), relative to i18n/<locale>/. Their `message` values
// are translated in place; a key the command adds arrives in English.
stringFiles: [
'code.json',
'docusaurus-theme-classic/navbar.json',
'docusaurus-theme-classic/footer.json',
'docusaurus-plugin-content-docs/current.json',
'docusaurus-plugin-content-docs-ai/current.json',
'docusaurus-plugin-content-blog-product/options.json',
'docusaurus-plugin-content-blog-providers/options.json',
'docusaurus-plugin-content-blog-tutorials/options.json',
],
// Keys that `write-translations` generates but that must keep the site's
// default (English, computed) value: a missing key falls back to it, a
// present one freezes it (the footer copyright would keep the year of the
// extraction). yarn i18n:strings removes them after every run.
stringKeysUseDefault: {
'docusaurus-theme-classic/footer.json': ['copyright', 'logo.alt'],
'docusaurus-theme-classic/navbar.json': ['logo.alt'],
'docusaurus-plugin-content-docs/current.json': ['version.label'],
'docusaurus-plugin-content-docs-ai/current.json': ['version.label'],
},
// Directories under src/ that `docusaurus write-translations` must not
// read. It globs every .js/.jsx under src/ with no node_modules exclusion,
// and src/modules/react-animated-term ships its own node_modules (36k
// files, some of which do not parse). They are moved aside for the
// duration of the extraction and put back.
extractorExcludes: ['src/modules/react-animated-term/node_modules'],
// Pre-commit hook (.githooks/pre-commit -> scripts/i18n/precommit.js):
// warn list the staged source pages whose translations will need
// updating, then let the commit through
// translate run the headless translator on them, verify, and stage
// the translations and the manifest into the same commit;
// a failure is reported and the commit still goes through
// off do nothing
// The I18N_PRECOMMIT environment variable overrides this per commit.
precommit: 'warn',
// Headless translation (yarn i18n:translate, and the hook in `translate`
// mode): one `claude -p "/<skill> <file> <locale>"` run per page, with the
// subscription login Claude Code already has. Tool access is limited to
// reading the repo, editing under i18n/, and the verify and diff scripts.
// `command` is the executable and any leading arguments: on this Windows
// machine Claude Code is installed in WSL, so the Windows side runs it
// through `wsl -e` (exec without the WSL login shell, so the tool rules
// with parentheses and globs arrive untouched; wsl.exe starts in the
// /mnt/c/... equivalent of the repo directory, so the skill and the
// scripts resolve as usual); from a WSL or POSIX shell the CLI is called
// directly.
// `subscriptionOnly`: the runs must draw on the Claude subscription that
// CLI is logged in with (`claude auth login`), never on API credits. The
// driver starts the CLI without ANTHROPIC_API_KEY and the other variables
// that override the stored login, and translates nothing unless
// `claude auth status` reports a claude.ai login with no API key in play.
// false allows whatever credential the CLI resolves.
// `settings`: a Claude Code settings file passed to every run (path from
// the repo root). It turns off `includeGitInstructions`, the git status
// snapshot the CLI takes at startup for its system prompt. A translation
// does not need it, and from WSL it is the slow part: WSL git reads the
// 37,000 tracked files of this Windows checkout through /mnt/c and had
// not finished after five minutes, before the first model call.
headless: {
command: process.platform === 'win32' ? ['wsl', '-e', 'claude'] : ['claude'],
subscriptionOnly: true,
settings: 'scripts/i18n/headless-settings.json',
skill: 'i18n-translate',
concurrency: 2,
timeoutMs: 15 * 60 * 1000,
},
};