# Translation Workflow

This is the project standard for translating UI texts safely and batch-wise.

## Scope
Always translate these core namespaces first:

- `common`
- `navigation`
- `club`
- `members`
- `diary`
- `trainingStats`
- `courtDrawingTool`

`de.json` is the source of truth. All other locales are validated against it.

## Acceptance Criteria
- No missing keys in the target locale
- No German fallback text left in non-German locales for the translated batch
- No placeholder mismatches such as `{count}` becoming `{anzahl}`
- Native characters must be used correctly
- `npm run build` must pass

## Native Characters
Do not replace native characters with ASCII fallbacks. Use the actual writing system or accents of the target language.

Examples:
- German: use `ä`, `ö`, `ü`, `ß`, not `ae`, `oe`, `ue`, `ss`
- French: use `é`, `è`, `à`, `ç`
- Spanish: use `á`, `é`, `í`, `ó`, `ú`, `ñ`
- Italian: use `à`, `è`, `é`, `ì`, `ò`, `ù`
- Polish: use `ą`, `ć`, `ę`, `ł`, `ń`, `ó`, `ś`, `ź`, `ż`
- Japanese: use Japanese scripts directly, not romanized fallback
- Chinese: use Chinese characters directly, not pinyin fallback
- Thai: use Thai script directly, not Latin transliteration

## Batches
- Batch A: `fr`, `es`
- Batch B: `it`, `pl`
- Batch C: `ja`, `zh`
- Batch D: `th`, `tl`, `fil`

Run one batch at a time. Finish the whole batch before moving on.

## Order Per Language
1. `common`
2. `navigation`
3. `club`
4. `members`
5. `diary`
6. `trainingStats`
7. `courtDrawingTool`

This keeps global UI stable first, then the larger feature areas.

## Per-Language Process
1. Run the status report to see the current batch state.
2. Open the target locale JSON.
3. Translate only visible UI text.
4. Keep product and domain names unchanged where appropriate:
   - `myTischtennis`
   - `click-TT`
   - `TTR`
   - `QTTR`
5. Keep placeholders unchanged:
   - correct: `"{count} open"`
   - wrong: `"{anzahl} offen"`
6. Save the file as valid UTF-8 JSON.

## Audit
Run the status report before starting a batch:

```bash
cd frontend
npm run i18n:status
```

Run the audit before and after translation work:

```bash
cd frontend
npm run i18n:audit -- fr es
```

The audit checks:
- missing keys in the core namespaces
- values still identical to German
- obvious German words left in non-German locales
- placeholder mismatches
- native-character coverage hints for languages that should visibly use them

## Build Check
After each language batch:

```bash
cd frontend
npm run build
```

## Suggested Working Loop
1. `npm run i18n:status`
2. Pick one batch
3. Translate one namespace across the whole batch, or one whole language, but stay consistent
4. Run `npm run i18n:audit -- <batch languages>`
5. Fix remaining `same as de`, German leftovers, or placeholder issues
6. Run `npm run build`
7. Do a manual UI pass

## Manual UI Check
Review these areas in the browser:
- `/members`
- `/diary`
- `/training-stats`
- exercise editor / court drawing dialog

Check especially:
- clipped labels
- wrong placeholders
- mixed-language screens
- broken interpolation text

## Definition of Done Per Batch
- `missing keys: 0`
- `german marker hits: 0`
- `placeholder mismatches: 0`
- `same as de` only for intentional product names or abbreviations
- manual spot check completed on:
  - `/members`
  - `/diary`
  - `/training-stats`
  - exercise editor / court drawing dialog
