Skip to content

Commit 67bd7a8

Browse files
Document path mappings workflow requirement
- Add Setup section with path_mappings.csv creation and import-paths requirement - Clarify that generate requires path mappings to be imported first - Add dedicated Path Mappings section explaining format and examples - Update Quick Start to show one-time setup (path mappings) vs recurring workflow - Add import-paths requirement to step-by-step workflow comments - Explains why generation fails with 'No path mappings' error This addresses user confusion about generation failing when path_mappings.csv exists but hasn't been imported via import-paths command. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 6346e74 commit 67bd7a8

1 file changed

Lines changed: 65 additions & 7 deletions

File tree

src/main/TRANSLATION_README.md

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ A Python-based system for managing multilingual HTML translations with explicit
44

55
## Quick Start (Recommended)
66

7-
Run the complete workflow with one command:
7+
**Setup (one-time):**
8+
```bash
9+
# 1. Create path mappings (map source paths to target paths)
10+
# Edit: ../photography/path_mappings.csv
11+
# Example:
12+
# source_lang,target_lang,source_path,target_path
13+
# en,es,en/travel,es/viajes
14+
# en,it,en/travel,it/viaggi
15+
16+
# 2. Import path mappings into database (required before generating!)
17+
python batch_translate.py import-paths
18+
```
819

20+
**Recurring workflow:**
921
```bash
1022
# Start web dashboard in separate terminal
1123
python batch_translate.py serve --port 8000
1224
# Opens: http://localhost:8000
1325

1426
# Run full pipeline (sync → validate → import → generate → validate → glossary)
15-
python batch_translate.py pipeline --target-langs es pt
27+
python batch_translate.py pipeline --target-langs es pt it
1628
# Answer prompts:
1729
# - Review CSVs in web dashboard (http://localhost:8000)
1830
# - Answer "Import now?" prompt when ready
@@ -25,7 +37,7 @@ For granular control:
2537

2638
```bash
2739
# 1. Extract changed files (parallel, with change detection)
28-
python batch_translate.py sync --source-dir en/travel --target-langs es pt
40+
python batch_translate.py sync --source-dir en/travel --target-langs es pt it
2941

3042
# 2. Review & edit in web dashboard (no CSV tool needed)
3143
python batch_translate.py serve --port 8000
@@ -36,14 +48,14 @@ python batch_translate.py validate-csv
3648
# 4. Import validated translations
3749
python batch_translate.py import
3850

39-
# 5. Generate translated files
40-
python batch_translate.py generate --source-dir en/travel --target-langs es pt --require-complete
51+
# 5. Generate translated files (requires path_mappings.csv imported via import-paths!)
52+
python batch_translate.py generate --target-langs es pt it --require-complete
4153

4254
# 6. Validate generated HTML files
43-
python batch_translate.py validate-html --target-langs es pt
55+
python batch_translate.py validate-html --target-langs es pt it
4456

4557
# 7. Export glossaries for next cycle
46-
python batch_translate.py glossary-sync --target-langs es pt
58+
python batch_translate.py glossary-sync --target-langs es pt it
4759
```
4860

4961
## Core Features
@@ -124,6 +136,52 @@ Pipeline Options:
124136
--force # Force re-extract all files (ignore change detection)
125137
```
126138

139+
## Path Mappings (Required for Generation)
140+
141+
Path mappings define where generated translated files go. **Generation will not work without importing path mappings first.**
142+
143+
### Setup Path Mappings
144+
145+
1. **Create path_mappings.csv**:
146+
```
147+
../photography/path_mappings.csv
148+
```
149+
150+
2. **Format** (CSV with headers):
151+
```csv
152+
source_lang,target_lang,source_path,target_path
153+
en,es,en/travel,es/viajes
154+
en,es,en/travel/cities.html,es/viajes/ciudades.html
155+
en,it,en/travel,it/viaggi
156+
en,pt,en/photography,pt/fotografia
157+
```
158+
159+
3. **Import into database** (must do this after editing):
160+
```bash
161+
python batch_translate.py import-paths
162+
```
163+
164+
**Important**: After editing `path_mappings.csv`, always run `import-paths` before generating. Without this, generation will fail with "No path mappings for {lang}".
165+
166+
### Path Mapping Examples
167+
168+
Directory-level (all files in directory):
169+
```csv
170+
en,es,en/travel,es/viajes
171+
```
172+
173+
File-level (specific file):
174+
```csv
175+
en,es,en/travel/index.html,es/viajes/index.html
176+
```
177+
178+
Multiple languages:
179+
```csv
180+
en,es,en/travel,es/viajes
181+
en,it,en/travel,it/viaggi
182+
en,pt,en/travel,pt/viagens
183+
```
184+
127185
## Workflow (Pipeline)
128186

129187
### Full Pipeline (Recommended)

0 commit comments

Comments
 (0)