# Translating Tane

Tane is multilingual **by design** — international, not any-country-first
(see the golden rules in [`../CLAUDE.md`](../CLAUDE.md)). Translations live as
one JSON file per locale, a format Weblate (and any translation platform that
speaks nested JSON) handles natively.

## Where strings live

```
apps/app_seeds/lib/i18n/
  en.i18n.json   ← base locale (source of truth for keys)
  es.i18n.json   ast, pt, fr, de, ja …
  strings*.g.dart  ← generated, do not edit
```

Live locales: `es`, `ast`, `en`, `pt`, `fr`, `de`, `ja`. Japanese (`ja`) is the
CJK reference — fittingly, the app's own name is Japanese (種, *tane*, "seed").
It ships only a core set of strings translated; the rest fall back to English,
which is exactly how a partial locale is meant to grow.

- Placeholders use braces: `"{count} entries added"`. Keep them verbatim.
- Keys are code and never change per locale; only values are translated.
- Missing keys fall back to English at runtime (`fallback_strategy:
  base_locale` in [`slang.yaml`](../apps/app_seeds/slang.yaml)), so a partial
  translation is shippable from day one.

## Adding a locale

1. Copy `en.i18n.json` to `<code>.i18n.json` (e.g. `fr.i18n.json`) and
   translate what you can.
2. Regenerate the Dart bindings:
   ```bash
   cd apps/app_seeds && dart run slang
   ```
3. Add a language tile in
   [`settings_screen.dart`](../apps/app_seeds/lib/ui/settings_screen.dart)
   (label = the language's own name, e.g. "Français") plus the `langXx` key in
   every locale file.
4. Run the tests: `flutter test` (an i18n test guards against hardcoded
   strings; the RTL smoke test guards right-to-left layouts).

## RTL and scripts

Right-to-left locales (Arabic, Hebrew, Persian) are first-class: layouts use
directional insets and are exercised by
[`rtl_smoke_test.dart`](../apps/app_seeds/test/ui/rtl_smoke_test.dart).

**Fonts cover the scripts we claim.** The UI text theme carries Noto Sans
Arabic + Noto Sans JP as per-glyph fallbacks (see
[`theme.dart`](../apps/app_seeds/lib/ui/theme.dart)), so RTL and CJK render on
every platform — including desktop, where the system font may lack them. Every
generated PDF shares the same fallbacks via
[`pdf_fonts.dart`](../apps/app_seeds/lib/services/pdf_fonts.dart), so labels and
catalogs print Arabic/CJK instead of tofu. Fonts are a per-locale resource,
extensible to any script; widen the fallback list as more scripts land.

Locale-specific resources ship with their locale, never hardcoded: OCR
language packs (`assets/tessdata/`), PDF fonts (`assets/fonts/`), and species
common names (`assets/catalog/species.json`, a locale-keyed map).

## Weblate

The JSON-per-locale layout is Weblate-ready (component per file, base
`en.i18n.json`). Hosting is not set up yet; when it is, this page will link
to the project. Until then, translation PRs/patches are welcome directly on
the files above.
