-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathbuild.translation.help.mjs
More file actions
185 lines (168 loc) Β· 6.28 KB
/
build.translation.help.mjs
File metadata and controls
185 lines (168 loc) Β· 6.28 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
#!/usr/bin/env node
// Simple console logging without complex color formatting
function log(message, color = 'reset') {
if (color === 'cyan' || color === 'blue') {
console.log(`\x1b[36m${message}\x1b[0m`);
} else if (color === 'yellow') {
console.log(`\x1b[33m${message}\x1b[0m`);
} else if (color === 'green') {
console.log(`\x1b[32m${message}\x1b[0m`);
} else if (color === 'bold') {
console.log(`\x1b[1m${message}\x1b[0m`);
} else if (color === 'gray') {
console.log(`\x1b[90m${message}\x1b[0m`);
} else {
console.log(message);
}
}
// Supported languages
const SUPPORTED_LANGUAGES = {
ar: 'Arabic',
de: 'German',
es: 'Spanish',
fr: 'French',
hi: 'Hindi',
id: 'Indonesian',
ja: 'Japanese',
ko: 'Korean',
pt: 'Portuguese',
ru: 'Russian',
tr: 'Turkish',
vi: 'Vietnamese',
'zh-CN': 'Chinese (Simplified)',
};
function showHelp() {
log('π Push Chain Translation System - Help', 'cyan');
log('β'.repeat(60), 'gray');
log('', 'reset');
log('π Available Commands:', 'bold');
log('', 'reset');
// Nuke command
log('π§Ή translations:nuke', 'yellow');
log(
' Clean up all auto-translated content and reset translation progress',
'gray'
);
log(
' β’ Removes all autotranslate folders from language directories',
'gray'
);
log(' β’ Cleans up translatemeta.json tracking file', 'gray');
log(' β’ Preserves English source files and directory structure', 'gray');
log(' Usage: yarn translations:nuke', 'cyan');
log('', 'reset');
// Generate command
log('π translations:generate', 'yellow');
log(' Generate translations for all supported languages using AI', 'gray');
log(' β’ Processes all 13 supported languages automatically', 'gray');
log(' β’ Uses smart chunk-based translation with rate limiting', 'gray');
log(' β’ Tracks progress and resumes from where it left off', 'gray');
log(' Usage: yarn translations:generate', 'cyan');
log('', 'reset');
// Generate force command
log('π₯ translations:generate:force', 'yellow');
log(' Clean up and regenerate all translations from scratch', 'gray');
log(' β’ Combines translations:nuke + translations:generate', 'gray');
log(' β’ Ensures completely fresh translation process', 'gray');
log(' β’ Use when you want to start over completely', 'gray');
log(' Usage: yarn translations:generate:force', 'cyan');
log('', 'reset');
// Generate specific command
log('π― translations:generate:specific', 'yellow');
log(' Generate translation for one specific language only', 'gray');
log(' β’ Faster than translating all languages', 'gray');
log(' β’ Perfect for testing or iterating on specific languages', 'gray');
log(
' β’ Temporarily modifies automation script for targeted translation',
'gray'
);
log(' Usage: yarn translations:generate:specific <language-code>', 'cyan');
log(' Example: yarn translations:generate:specific es', 'cyan');
log('', 'reset');
log('π£οΈ Supported Languages:', 'bold');
log('', 'reset');
Object.entries(SUPPORTED_LANGUAGES).forEach(([code, name]) => {
log(` ${code.padEnd(6)} - ${name}`, 'green');
});
log('', 'reset');
log('βοΈ Environment Configuration:', 'bold');
log('', 'reset');
log(' AI Provider Settings:', 'yellow');
log(' β’ AI_PROVIDER=windsurf|local (default: windsurf)', 'gray');
log(' β’ WINDSURF_API_KEY=<key> (for Windsurf/Anthropic)', 'gray');
log(' β’ LOCAL_AI_BASE_URL=<url> (for local AI)', 'gray');
log(' β’ LOCAL_AI_MODEL=<model> (for local AI)', 'gray');
log('', 'reset');
log(' Translation Settings:', 'yellow');
log(' β’ AI_MAX_INPUT_TOKENS=100000 (max input tokens)', 'gray');
log(
' β’ AI_MAX_CHUNK_TOKENS=2000 (max tokens per chunk)',
'gray'
);
log(
' β’ AI_CHARS_PER_TOKEN=3.5 (characters per token)',
'gray'
);
log(
' β’ AI_RATE_LIMIT_PER_MINUTE=5 (API calls per minute)',
'gray'
);
log(
' β’ AI_REQUEST_TIMEOUT=60000 (timeout in milliseconds)',
'gray'
);
log('', 'reset');
log('π Translation Workflow:', 'bold');
log('', 'reset');
log(' 1. Clean slate: yarn translations:nuke', 'cyan');
log(' 2. Generate all: yarn translations:generate', 'cyan');
log(
' 3. Test specific: yarn translations:generate:specific <lang>',
'cyan'
);
log(' 4. Force rebuild: yarn translations:generate:force', 'cyan');
log('', 'reset');
log('π‘ Tips & Best Practices:', 'bold');
log('', 'reset');
log(' β’ Always test translations locally with "yarn start"', 'yellow');
log(' β’ Use specific language generation for faster iteration', 'yellow');
log(' β’ Check translatemeta.json to see translation progress', 'yellow');
log(' β’ Set appropriate AI_REQUEST_TIMEOUT for your AI provider', 'yellow');
log(' β’ Local AI may need higher timeout values than Windsurf', 'yellow');
log('', 'reset');
log('π Troubleshooting:', 'bold');
log('', 'reset');
log(' β’ Rate limit errors: Reduce AI_RATE_LIMIT_PER_MINUTE', 'yellow');
log(' β’ Timeout errors: Increase AI_REQUEST_TIMEOUT', 'yellow');
log(' β’ Chunk too large: Reduce AI_MAX_CHUNK_TOKENS', 'yellow');
log(' β’ Translation stuck: Run translations:nuke and try again', 'yellow');
log(' β’ API errors: Check your API keys and provider settings', 'yellow');
log('', 'reset');
log('π File Structure:', 'bold');
log('', 'reset');
log(' static/locales/en/01-translate/ - English source chunks', 'gray');
log(
' static/locales/<lang>/autotranslate/ - Auto-generated translations',
'gray'
);
log(
' translatemeta.json - Translation progress tracking',
'gray'
);
log('', 'reset');
log('π Related Commands:', 'bold');
log('', 'reset');
log(
' yarn start - Start development server',
'cyan'
);
log(' yarn build - Build production site', 'cyan');
log(
' yarn write-translations - Generate Docusaurus i18n files',
'cyan'
);
log('', 'reset');
log('β'.repeat(60), 'gray');
log('For more information, visit the Push Protocol documentation.', 'blue');
}
showHelp();