proagents 1.6.16 → 1.6.18
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/.claude/settings.local.json +169 -0
- package/COMMANDS.md +595 -0
- package/README.md +22 -64
- package/bin/proagents.js +0 -2
- package/lib/commands/init.js +4 -174
- package/package.json +2 -7
- package/.proagents/ai-models/README.md +0 -141
- package/.proagents/ai-models/cost-management.md +0 -362
- package/.proagents/ai-models/fallbacks.md +0 -342
- package/.proagents/ai-models/model-config.md +0 -318
- package/.proagents/ai-models/task-routing.md +0 -503
- package/.proagents/ai-training/README.md +0 -155
- package/.proagents/ai-training/continuous-learning.md +0 -413
- package/.proagents/ai-training/domain-knowledge.md +0 -378
- package/.proagents/ai-training/pattern-learning.md +0 -455
- package/.proagents/ai-training/training-data.md +0 -337
- package/.proagents/ai-training/user-preferences.md +0 -346
- package/.proagents/approval-workflows/README.md +0 -146
- package/.proagents/approval-workflows/approval-config.md +0 -332
- package/.proagents/approval-workflows/approval-stages.md +0 -503
- package/.proagents/approval-workflows/emergency-bypass.md +0 -351
- package/.proagents/approval-workflows/examples.md +0 -859
- package/.proagents/approval-workflows/notifications.md +0 -320
- package/.proagents/compliance/README.md +0 -206
- package/.proagents/compliance/access-control.md +0 -310
- package/.proagents/compliance/audit-logging.md +0 -444
- package/.proagents/compliance/compliance-frameworks.md +0 -429
- package/.proagents/compliance/reports.md +0 -491
- package/.proagents/compliance/retention-policies.md +0 -454
- package/.proagents/config-versioning/README.md +0 -120
- package/.proagents/config-versioning/changelog.md +0 -300
- package/.proagents/config-versioning/rollback.md +0 -283
- package/.proagents/config-versioning/versioning.md +0 -330
- package/.proagents/contract-testing/README.md +0 -223
- package/.proagents/contract-testing/contract-testing.md +0 -614
- package/.proagents/contract-testing/pact-integration.md +0 -507
- package/.proagents/contract-testing/schema-validation.md +0 -565
- package/.proagents/dependency-management/README.md +0 -140
- package/.proagents/dependency-management/automation.md +0 -363
- package/.proagents/dependency-management/compatibility.md +0 -319
- package/.proagents/dependency-management/security-scanning.md +0 -413
- package/.proagents/dependency-management/update-policies.md +0 -374
- package/.proagents/disaster-recovery/README.md +0 -247
- package/.proagents/disaster-recovery/automation.md +0 -366
- package/.proagents/disaster-recovery/backup-recovery.md +0 -571
- package/.proagents/disaster-recovery/incident-response.md +0 -565
- package/.proagents/disaster-recovery/rollback-procedures.md +0 -499
- package/.proagents/disaster-recovery/runbooks.md +0 -603
- package/.proagents/disaster-recovery/scenarios.md +0 -892
- package/.proagents/disaster-recovery/testing.md +0 -438
- package/.proagents/environments/README.md +0 -244
- package/.proagents/environments/configuration.md +0 -437
- package/.proagents/environments/promotion.md +0 -434
- package/.proagents/environments/setup.md +0 -420
- package/.proagents/examples/README.md +0 -55
- package/.proagents/examples/backend-nodejs/README.md +0 -188
- package/.proagents/examples/backend-nodejs/complete-conversation.md +0 -601
- package/.proagents/examples/backend-nodejs/proagents.config.yaml +0 -415
- package/.proagents/examples/backend-nodejs/workflow-example.md +0 -909
- package/.proagents/examples/fullstack-nextjs/README.md +0 -155
- package/.proagents/examples/fullstack-nextjs/complete-conversation.md +0 -604
- package/.proagents/examples/fullstack-nextjs/proagents.config.yaml +0 -287
- package/.proagents/examples/fullstack-nextjs/workflow-example.md +0 -553
- package/.proagents/examples/mobile-react-native/README.md +0 -171
- package/.proagents/examples/mobile-react-native/complete-conversation.md +0 -825
- package/.proagents/examples/mobile-react-native/proagents.config.yaml +0 -330
- package/.proagents/examples/mobile-react-native/workflow-example.md +0 -723
- package/.proagents/examples/web-frontend-react/README.md +0 -125
- package/.proagents/examples/web-frontend-react/complete-conversation.md +0 -556
- package/.proagents/examples/web-frontend-react/proagents.config.yaml +0 -183
- package/.proagents/examples/web-frontend-react/workflow-example.md +0 -603
- package/.proagents/existing-projects/README.md +0 -65
- package/.proagents/existing-projects/challenges.md +0 -861
- package/.proagents/existing-projects/coexistence-mode.md +0 -483
- package/.proagents/existing-projects/compatibility-assessment.md +0 -541
- package/.proagents/existing-projects/gradual-adoption.md +0 -515
- package/.proagents/existing-projects/migration-strategies.md +0 -788
- package/.proagents/existing-projects/pattern-reconciliation.md +0 -489
- package/.proagents/existing-projects/team-onboarding.md +0 -617
- package/.proagents/existing-projects/technical-debt-handling.md +0 -644
- package/.proagents/feature-flags/README.md +0 -263
- package/.proagents/feature-flags/ab-testing.md +0 -413
- package/.proagents/feature-flags/configuration.md +0 -420
- package/.proagents/feature-flags/kill-switches.md +0 -444
- package/.proagents/feature-flags/rollout-strategies.md +0 -392
- package/.proagents/history.log +0 -12
- package/.proagents/i18n/README.md +0 -133
- package/.proagents/i18n/extraction.md +0 -433
- package/.proagents/i18n/tms-integration.md +0 -332
- package/.proagents/i18n/translation-workflow.md +0 -413
- package/.proagents/i18n/validation.md +0 -355
- package/.proagents/logging/README.md +0 -276
- package/.proagents/logging/aggregation.md +0 -475
- package/.proagents/logging/log-levels.md +0 -376
- package/.proagents/logging/sensitive-data.md +0 -423
- package/.proagents/logging/structured-logging.md +0 -406
- package/.proagents/metrics/README.md +0 -69
- package/.proagents/metrics/code-quality-kpis.md +0 -461
- package/.proagents/metrics/deployment-metrics.md +0 -517
- package/.proagents/metrics/developer-productivity.md +0 -368
- package/.proagents/metrics/learning-effectiveness.md +0 -478
- package/.proagents/migrations/README.md +0 -77
- package/.proagents/migrations/from-claude-projects.md +0 -313
- package/.proagents/migrations/from-cursor-rules.md +0 -345
- package/.proagents/migrations/from-custom-workflows.md +0 -410
- package/.proagents/monitoring/README.md +0 -308
- package/.proagents/monitoring/alerting.md +0 -449
- package/.proagents/monitoring/dashboards.md +0 -454
- package/.proagents/monitoring/health-checks.md +0 -436
- package/.proagents/monitoring/metrics.md +0 -434
- package/.proagents/multi-project/README.md +0 -170
- package/.proagents/multi-project/coordinated-deploy.md +0 -510
- package/.proagents/multi-project/cross-project-deps.md +0 -395
- package/.proagents/multi-project/unified-changelog.md +0 -477
- package/.proagents/multi-project/walkthroughs/monorepo-setup.md +0 -787
- package/.proagents/multi-project/workspace-config.md +0 -408
- package/.proagents/notifications/README.md +0 -151
- package/.proagents/notifications/channels.md +0 -457
- package/.proagents/notifications/preferences.md +0 -415
- package/.proagents/notifications/routing.md +0 -449
- package/.proagents/notifications/scheduling.md +0 -425
- package/.proagents/notifications/templates.md +0 -446
- package/.proagents/offline-mode/README.md +0 -145
- package/.proagents/offline-mode/caching.md +0 -344
- package/.proagents/offline-mode/offline-operations.md +0 -312
- package/.proagents/offline-mode/queue-specifications.md +0 -679
- package/.proagents/offline-mode/sync.md +0 -475
- package/.proagents/parallel-features/README.md +0 -85
- package/.proagents/parallel-features/conflict-detection.md +0 -226
- package/.proagents/parallel-features/dependency-management.md +0 -392
- package/.proagents/parallel-features/merge-coordination.md +0 -506
- package/.proagents/parallel-features/tracking-system.md +0 -416
- package/.proagents/performance/README.md +0 -59
- package/.proagents/performance/bundle-analysis.md +0 -375
- package/.proagents/performance/load-testing.md +0 -563
- package/.proagents/performance/runtime-metrics.md +0 -489
- package/.proagents/performance/web-vitals.md +0 -425
- package/.proagents/plugins/README.md +0 -139
- package/.proagents/plugins/creating-plugins.md +0 -504
- package/.proagents/plugins/plugin-api.md +0 -467
- package/.proagents/plugins/plugin-registry.md +0 -276
- package/.proagents/reporting/README.md +0 -158
- package/.proagents/reporting/dashboards.md +0 -366
- package/.proagents/reporting/exports.md +0 -524
- package/.proagents/reporting/quality-metrics.md +0 -385
- package/.proagents/reporting/templates/README.md +0 -56
- package/.proagents/reporting/templates/dashboard-config.json +0 -187
- package/.proagents/reporting/templates/metrics-queries.md +0 -427
- package/.proagents/reporting/templates/react-dashboard.tsx +0 -544
- package/.proagents/reporting/templates/widgets.md +0 -451
- package/.proagents/reporting/velocity-metrics.md +0 -340
- package/.proagents/reverse-engineering/README.md +0 -151
- package/.proagents/reverse-engineering/architecture-extraction.md +0 -325
- package/.proagents/reverse-engineering/code-analysis.md +0 -377
- package/.proagents/reverse-engineering/dependency-mapping.md +0 -567
- package/.proagents/reverse-engineering/diagram-generation.md +0 -586
- package/.proagents/reverse-engineering/documentation-generation.md +0 -468
- package/.proagents/reverse-engineering/pattern-detection.md +0 -569
- package/.proagents/reverse-engineering/quality-assessment.md +0 -733
- package/.proagents/secrets/README.md +0 -278
- package/.proagents/secrets/access-control.md +0 -443
- package/.proagents/secrets/rotation.md +0 -403
- package/.proagents/secrets/scanning.md +0 -487
- package/.proagents/secrets/storage.md +0 -394
- package/.proagents/webhooks/README.md +0 -126
- package/.proagents/webhooks/endpoints.md +0 -298
- package/.proagents/webhooks/events.md +0 -316
- package/.proagents/webhooks/payloads.md +0 -325
- package/.proagents/webhooks/reliability.md +0 -363
- package/.proagents/webhooks/security.md +0 -380
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
# String Extraction
|
|
2
|
-
|
|
3
|
-
Automatically extract translatable strings from your codebase.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
11
|
-
│ Extraction Process │
|
|
12
|
-
├─────────────────────────────────────────────────────────────┤
|
|
13
|
-
│ │
|
|
14
|
-
│ Source Code │
|
|
15
|
-
│ ┌─────────────────────────────────────────────────────┐ │
|
|
16
|
-
│ │ const message = t('welcome.title'); │ │
|
|
17
|
-
│ │ <Trans i18nKey="welcome.subtitle">Welcome!</Trans> │ │
|
|
18
|
-
│ └─────────────────────────────────────────────────────┘ │
|
|
19
|
-
│ │ │
|
|
20
|
-
│ ▼ │
|
|
21
|
-
│ ┌─────────────────┐ │
|
|
22
|
-
│ │ Extractor │ │
|
|
23
|
-
│ └────────┬────────┘ │
|
|
24
|
-
│ │ │
|
|
25
|
-
│ ▼ │
|
|
26
|
-
│ Translation Files │
|
|
27
|
-
│ ┌─────────────────────────────────────────────────────┐ │
|
|
28
|
-
│ │ { │ │
|
|
29
|
-
│ │ "welcome": { │ │
|
|
30
|
-
│ │ "title": "Welcome", │ │
|
|
31
|
-
│ │ "subtitle": "Welcome!" │ │
|
|
32
|
-
│ │ } │ │
|
|
33
|
-
│ │ } │ │
|
|
34
|
-
│ └─────────────────────────────────────────────────────┘ │
|
|
35
|
-
│ │
|
|
36
|
-
└─────────────────────────────────────────────────────────────┘
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Extraction Configuration
|
|
42
|
-
|
|
43
|
-
### Basic Setup
|
|
44
|
-
|
|
45
|
-
```yaml
|
|
46
|
-
i18n:
|
|
47
|
-
extraction:
|
|
48
|
-
# Patterns to match
|
|
49
|
-
patterns:
|
|
50
|
-
# Function calls
|
|
51
|
-
- pattern: "t\\(['\"](.+?)['\"]"
|
|
52
|
-
type: "function"
|
|
53
|
-
|
|
54
|
-
- pattern: "i18n\\.t\\(['\"](.+?)['\"]"
|
|
55
|
-
type: "function"
|
|
56
|
-
|
|
57
|
-
# React components
|
|
58
|
-
- pattern: "<Trans\\s+i18nKey=['\"](.+?)['\"]"
|
|
59
|
-
type: "component"
|
|
60
|
-
|
|
61
|
-
- pattern: "<Trans>(.+?)</Trans>"
|
|
62
|
-
type: "component_content"
|
|
63
|
-
|
|
64
|
-
# Files to scan
|
|
65
|
-
include:
|
|
66
|
-
- "src/**/*.ts"
|
|
67
|
-
- "src/**/*.tsx"
|
|
68
|
-
- "src/**/*.js"
|
|
69
|
-
- "src/**/*.jsx"
|
|
70
|
-
|
|
71
|
-
# Files to exclude
|
|
72
|
-
exclude:
|
|
73
|
-
- "**/*.test.*"
|
|
74
|
-
- "**/*.spec.*"
|
|
75
|
-
- "**/node_modules/**"
|
|
76
|
-
- "**/dist/**"
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Advanced Patterns
|
|
80
|
-
|
|
81
|
-
```yaml
|
|
82
|
-
i18n:
|
|
83
|
-
extraction:
|
|
84
|
-
patterns:
|
|
85
|
-
# With default value
|
|
86
|
-
- pattern: "t\\(['\"](.+?)['\"],\\s*['\"](.+?)['\"]\\)"
|
|
87
|
-
type: "function_with_default"
|
|
88
|
-
key_group: 1
|
|
89
|
-
default_group: 2
|
|
90
|
-
|
|
91
|
-
# With options
|
|
92
|
-
- pattern: "t\\(['\"](.+?)['\"],\\s*\\{[^}]*\\}\\)"
|
|
93
|
-
type: "function_with_options"
|
|
94
|
-
|
|
95
|
-
# Plurals
|
|
96
|
-
- pattern: "t\\(['\"](.+?)['\"],\\s*\\{\\s*count:"
|
|
97
|
-
type: "plural"
|
|
98
|
-
|
|
99
|
-
# Template literals
|
|
100
|
-
- pattern: "t\\(`(.+?)`\\)"
|
|
101
|
-
type: "template_literal"
|
|
102
|
-
warning: "Dynamic keys cannot be extracted"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Running Extraction
|
|
108
|
-
|
|
109
|
-
### Basic Extraction
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Extract all strings
|
|
113
|
-
proagents i18n extract
|
|
114
|
-
|
|
115
|
-
# Extract to specific directory
|
|
116
|
-
proagents i18n extract --output src/locales
|
|
117
|
-
|
|
118
|
-
# Dry run (preview only)
|
|
119
|
-
proagents i18n extract --dry-run
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Extraction Options
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Extract with specific format
|
|
126
|
-
proagents i18n extract --format json
|
|
127
|
-
|
|
128
|
-
# Extract only new keys
|
|
129
|
-
proagents i18n extract --new-only
|
|
130
|
-
|
|
131
|
-
# Extract with context
|
|
132
|
-
proagents i18n extract --include-context
|
|
133
|
-
|
|
134
|
-
# Extract to specific namespace
|
|
135
|
-
proagents i18n extract --namespace common
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Output
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
142
|
-
│ String Extraction Results │
|
|
143
|
-
├─────────────────────────────────────────────────────────────┤
|
|
144
|
-
│ │
|
|
145
|
-
│ Files Scanned: 145 │
|
|
146
|
-
│ Strings Extracted: 342 │
|
|
147
|
-
│ │
|
|
148
|
-
│ New Keys: 12 │
|
|
149
|
-
│ ├── common.save │
|
|
150
|
-
│ ├── common.cancel │
|
|
151
|
-
│ ├── auth.login_button │
|
|
152
|
-
│ └── ... 9 more │
|
|
153
|
-
│ │
|
|
154
|
-
│ Warnings: 3 │
|
|
155
|
-
│ ├── src/utils/format.ts:15 - Dynamic key detected │
|
|
156
|
-
│ ├── src/components/Menu.tsx:42 - Missing default value │
|
|
157
|
-
│ └── src/pages/Home.tsx:78 - Duplicate key │
|
|
158
|
-
│ │
|
|
159
|
-
│ Output: src/locales/en/extracted.json │
|
|
160
|
-
│ │
|
|
161
|
-
└─────────────────────────────────────────────────────────────┘
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Key Naming
|
|
167
|
-
|
|
168
|
-
### Naming Convention
|
|
169
|
-
|
|
170
|
-
```yaml
|
|
171
|
-
i18n:
|
|
172
|
-
key_naming:
|
|
173
|
-
# Convention
|
|
174
|
-
style: "dot_notation" # dot_notation, snake_case, camelCase
|
|
175
|
-
|
|
176
|
-
# Auto-generate key from content
|
|
177
|
-
auto_generate:
|
|
178
|
-
enabled: true
|
|
179
|
-
max_length: 40
|
|
180
|
-
hash_suffix: false
|
|
181
|
-
|
|
182
|
-
# Namespace from file path
|
|
183
|
-
namespace_from_path:
|
|
184
|
-
enabled: true
|
|
185
|
-
base_path: "src"
|
|
186
|
-
mapping:
|
|
187
|
-
"components": "common"
|
|
188
|
-
"pages": "pages"
|
|
189
|
-
"features": "features"
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Examples
|
|
193
|
-
|
|
194
|
-
```typescript
|
|
195
|
-
// File: src/components/Button.tsx
|
|
196
|
-
t('common.button.submit') // Namespace: common
|
|
197
|
-
|
|
198
|
-
// File: src/pages/Login.tsx
|
|
199
|
-
t('pages.login.title') // Namespace: pages
|
|
200
|
-
|
|
201
|
-
// File: src/features/checkout/Cart.tsx
|
|
202
|
-
t('features.checkout.cart.empty') // Namespace: features
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Default Values
|
|
208
|
-
|
|
209
|
-
### Extract with Defaults
|
|
210
|
-
|
|
211
|
-
```yaml
|
|
212
|
-
i18n:
|
|
213
|
-
extraction:
|
|
214
|
-
default_values:
|
|
215
|
-
enabled: true
|
|
216
|
-
source: "code" # code, comment, second_argument
|
|
217
|
-
|
|
218
|
-
# From code content
|
|
219
|
-
patterns:
|
|
220
|
-
- "<Trans>(.+?)</Trans>"
|
|
221
|
-
|
|
222
|
-
# From comments
|
|
223
|
-
comment_pattern: "// i18n: (.+)"
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### In Code
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
// Default from second argument
|
|
230
|
-
t('welcome.title', 'Welcome to our app')
|
|
231
|
-
|
|
232
|
-
// Default from component content
|
|
233
|
-
<Trans i18nKey="welcome.subtitle">
|
|
234
|
-
Welcome to our amazing application!
|
|
235
|
-
</Trans>
|
|
236
|
-
|
|
237
|
-
// Default from comment
|
|
238
|
-
// i18n: Click here to continue
|
|
239
|
-
t('common.continue')
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## Namespace Management
|
|
245
|
-
|
|
246
|
-
### Multiple Namespaces
|
|
247
|
-
|
|
248
|
-
```yaml
|
|
249
|
-
i18n:
|
|
250
|
-
namespaces:
|
|
251
|
-
# Define namespaces
|
|
252
|
-
list:
|
|
253
|
-
- name: "common"
|
|
254
|
-
description: "Shared UI strings"
|
|
255
|
-
files: "src/components/**"
|
|
256
|
-
|
|
257
|
-
- name: "pages"
|
|
258
|
-
description: "Page-specific strings"
|
|
259
|
-
files: "src/pages/**"
|
|
260
|
-
|
|
261
|
-
- name: "errors"
|
|
262
|
-
description: "Error messages"
|
|
263
|
-
files: "src/errors/**"
|
|
264
|
-
|
|
265
|
-
- name: "validation"
|
|
266
|
-
description: "Form validation"
|
|
267
|
-
files: "src/validation/**"
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Output Structure
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
src/locales/
|
|
274
|
-
├── en/
|
|
275
|
-
│ ├── common.json
|
|
276
|
-
│ ├── pages.json
|
|
277
|
-
│ ├── errors.json
|
|
278
|
-
│ └── validation.json
|
|
279
|
-
├── es/
|
|
280
|
-
│ ├── common.json
|
|
281
|
-
│ └── ...
|
|
282
|
-
└── fr/
|
|
283
|
-
└── ...
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Incremental Extraction
|
|
289
|
-
|
|
290
|
-
### Track Changes
|
|
291
|
-
|
|
292
|
-
```yaml
|
|
293
|
-
i18n:
|
|
294
|
-
extraction:
|
|
295
|
-
incremental:
|
|
296
|
-
enabled: true
|
|
297
|
-
tracking_file: ".proagents/i18n-state.json"
|
|
298
|
-
|
|
299
|
-
# Only extract from changed files
|
|
300
|
-
changed_files_only: true
|
|
301
|
-
|
|
302
|
-
# Add new keys without removing old
|
|
303
|
-
merge_strategy: "add_only"
|
|
304
|
-
|
|
305
|
-
# Remove unused keys
|
|
306
|
-
remove_unused:
|
|
307
|
-
enabled: false
|
|
308
|
-
after_days: 30
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Commands
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
# Extract only from changed files
|
|
315
|
-
proagents i18n extract --incremental
|
|
316
|
-
|
|
317
|
-
# Extract and remove unused
|
|
318
|
-
proagents i18n extract --prune-unused
|
|
319
|
-
|
|
320
|
-
# Full re-extraction
|
|
321
|
-
proagents i18n extract --full
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
## Context and Comments
|
|
327
|
-
|
|
328
|
-
### Add Context for Translators
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
// Add context as comment
|
|
332
|
-
// i18n-context: Button shown after successful payment
|
|
333
|
-
t('checkout.success_button')
|
|
334
|
-
|
|
335
|
-
// Or in options
|
|
336
|
-
t('checkout.success_button', {
|
|
337
|
-
context: 'Button shown after successful payment'
|
|
338
|
-
})
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Extract Context
|
|
342
|
-
|
|
343
|
-
```yaml
|
|
344
|
-
i18n:
|
|
345
|
-
extraction:
|
|
346
|
-
context:
|
|
347
|
-
enabled: true
|
|
348
|
-
sources:
|
|
349
|
-
- "comment" # // i18n-context: ...
|
|
350
|
-
- "option" # t('key', { context: '...' })
|
|
351
|
-
- "jsdoc" # /** @i18n-context ... */
|
|
352
|
-
|
|
353
|
-
output:
|
|
354
|
-
include_in_json: true
|
|
355
|
-
separate_file: false
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Output with Context
|
|
359
|
-
|
|
360
|
-
```json
|
|
361
|
-
{
|
|
362
|
-
"checkout": {
|
|
363
|
-
"success_button": {
|
|
364
|
-
"value": "Continue Shopping",
|
|
365
|
-
"context": "Button shown after successful payment",
|
|
366
|
-
"source": "src/pages/Checkout.tsx:145"
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
---
|
|
373
|
-
|
|
374
|
-
## Validation During Extraction
|
|
375
|
-
|
|
376
|
-
### Validate Keys
|
|
377
|
-
|
|
378
|
-
```yaml
|
|
379
|
-
i18n:
|
|
380
|
-
extraction:
|
|
381
|
-
validation:
|
|
382
|
-
# Check for duplicate keys
|
|
383
|
-
duplicates: "error"
|
|
384
|
-
|
|
385
|
-
# Check for invalid characters
|
|
386
|
-
invalid_chars: "error"
|
|
387
|
-
|
|
388
|
-
# Check key length
|
|
389
|
-
max_key_length: 100
|
|
390
|
-
|
|
391
|
-
# Check for dynamic keys
|
|
392
|
-
dynamic_keys: "warning"
|
|
393
|
-
|
|
394
|
-
# Check for missing defaults
|
|
395
|
-
missing_defaults: "warning"
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Validation Output
|
|
399
|
-
|
|
400
|
-
```
|
|
401
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
402
|
-
│ Extraction Validation │
|
|
403
|
-
├─────────────────────────────────────────────────────────────┤
|
|
404
|
-
│ │
|
|
405
|
-
│ Errors (2): │
|
|
406
|
-
│ ├── src/components/Menu.tsx:42 │
|
|
407
|
-
│ │ Duplicate key: 'common.menu.home' │
|
|
408
|
-
│ │ First occurrence: src/components/Header.tsx:15 │
|
|
409
|
-
│ │ │
|
|
410
|
-
│ └── src/pages/Settings.tsx:78 │
|
|
411
|
-
│ Invalid characters in key: 'settings.user name' │
|
|
412
|
-
│ Suggestion: 'settings.user_name' │
|
|
413
|
-
│ │
|
|
414
|
-
│ Warnings (3): │
|
|
415
|
-
│ ├── Dynamic key detected (cannot extract) │
|
|
416
|
-
│ └── Missing default value (2 occurrences) │
|
|
417
|
-
│ │
|
|
418
|
-
│ Extraction blocked due to errors. Fix and retry. │
|
|
419
|
-
│ │
|
|
420
|
-
└─────────────────────────────────────────────────────────────┘
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
## Best Practices
|
|
426
|
-
|
|
427
|
-
1. **Consistent Naming**: Use a consistent key naming convention
|
|
428
|
-
2. **Provide Defaults**: Always include default English text
|
|
429
|
-
3. **Add Context**: Help translators understand usage
|
|
430
|
-
4. **Use Namespaces**: Organize keys by feature/page
|
|
431
|
-
5. **Avoid Dynamic Keys**: Extract only static keys
|
|
432
|
-
6. **Run Regularly**: Extract as part of development workflow
|
|
433
|
-
7. **Review Changes**: Check extracted keys before sending for translation
|