fix(docs): correct malformed markdown in extract-translations command

Fix broken markdown formatting where multiple sections were collapsed
into a single malformed block. Properly structure HTML/TypeScript code
examples, key naming conventions, usage examples, and edge cases. #6004
This commit is contained in:
Johannes Millan 2026-01-15 13:21:58 +01:00
parent 9a1e0a2dd8
commit 05da537e45

View file

@ -1,8 +1,8 @@
<task>
You are a translation extraction specialist that identifies untranslated strings in recently changed HTML and TypeScript files, extracts them to the translation files, and updates the source code to use translation keys.
</task>
<task>
You are a translation extraction specialist that identifies untranslated strings in recently changed HTML and TypeScript files, extracts them to the translation files, and updates the source code to use translation keys.
</task>
<workflow>
<workflow>
## Phase 1: Identify Changed Files
@ -63,14 +63,14 @@ For each changed file:
2. Verify changes compile correctly
3. Report summary of changes
</workflow>
</workflow>
<arguments>
Optional arguments:
- `--days <number>`: How many days back to check for changes (default: 7)
- `--dry-run`: Preview changes without modifying files
- `--interactive`: Confirm each extraction before applying
</arguments>
<arguments>
Optional arguments:
- `--days <number>`: How many days back to check for changes (default: 7)
- `--dry-run`: Preview changes without modifying files
- `--interactive`: Confirm each extraction before applying
</arguments>
<extraction_patterns>
@ -88,25 +88,80 @@ For each changed file:
<!-- Skip these -->
<button>{{ T.BUTTON_CLICK }}</button>
<mat-label>{{ 'LABEL_NAME' | translate }}</mat-label>
TypeScript Files // Extract these this.snackBar.open('Success!', 'OK'); const message =
'Error occurred'; dialogConfig.data = { title: 'Confirm' }; // Skip these
this.snackBar.open(T.SUCCESS_MESSAGE, T.OK); const message = T.ERROR_OCCURRED; Follow
the existing pattern in en.json: - Feature-based grouping: FEATURE_COMPONENT_ELEMENT -
Action-based: ACTION_CONTEXT - Common elements: COMMON_ELEMENT_TYPE Examples: -
TASK_LIST_EMPTY_MESSAGE - DIALOG_CONFIRM_TITLE - BUTTON_SAVE # Extract translations from
files changed in last week /extract-translations # Check changes from last 3 days only
/extract-translations --days 3 # Preview without making changes /extract-translations
--dry-run # Interactive mode for selective extraction /extract-translations
--interactive Handle these edge cases: 1. Existing translations: Check if string already
has a key 2. Dynamic strings: Skip template literals and concatenations 3. Special
characters: Properly escape in JSON 4. File permissions: Ensure write access to
translation files 5. Git conflicts: Warn if en.json has uncommitted changes Summary
Report Translation Extraction Complete ============================== Files analyzed: 12
Strings extracted: 8 Keys generated: 8 Changes by file: -
src/app/features/tasks/task-list.component.html ✓ "No tasks" → T.TASK_LIST_EMPTY ✓ "Add
task" → T.TASK_ADD_BUTTON - src/app/features/tasks/task.service.ts ✓ "Task saved" →
T.TASK_SAVED_MESSAGE Translation file updated: src/assets/i18n/en.json Build command
executed: npm run int
</div>
```
### TypeScript Files
```typescript
// Extract these
this.snackBar.open('Success!', 'OK');
const message = 'Error occurred';
dialogConfig.data = { title: 'Confirm' };
// Skip these
this.snackBar.open(T.SUCCESS_MESSAGE, T.OK);
const message = T.ERROR_OCCURRED;
```
### Key Naming Conventions
Follow the existing pattern in en.json:
- Feature-based grouping: `FEATURE_COMPONENT_ELEMENT`
- Action-based: `ACTION_CONTEXT`
- Common elements: `COMMON_ELEMENT_TYPE`
Examples:
- `TASK_LIST_EMPTY_MESSAGE`
- `DIALOG_CONFIRM_TITLE`
- `BUTTON_SAVE`
</extraction_patterns>
## Usage Examples
```bash
# Extract translations from files changed in last week
/extract-translations
# Check changes from last 3 days only
/extract-translations --days 3
# Preview without making changes
/extract-translations --dry-run
# Interactive mode for selective extraction
/extract-translations --interactive
```
## Edge Cases
Handle these edge cases:
1. Existing translations: Check if string already has a key
2. Dynamic strings: Skip template literals and concatenations
3. Special characters: Properly escape in JSON
4. File permissions: Ensure write access to translation files
5. Git conflicts: Warn if en.json has uncommitted changes
## Summary Report Example
```
Translation Extraction Complete
==============================
Files analyzed: 12
Strings extracted: 8
Keys generated: 8
Changes by file:
- src/app/features/tasks/task-list.component.html
✓ "No tasks" → T.TASK_LIST_EMPTY
✓ "Add task" → T.TASK_ADD_BUTTON
- src/app/features/tasks/task.service.ts
✓ "Task saved" → T.TASK_SAVED_MESSAGE
Translation file updated: src/assets/i18n/en.json
Build command executed: npm run int
```