feat(i18n): full RTL/CJK support — fonts, Japanese locale, directional fixes

Bundle Noto Sans Arabic + Noto Sans JP (SIL OFL 1.1) as per-glyph fallbacks
for both the UI text theme and every generated PDF, so RTL (Arabic) and CJK
render on all platforms — including desktop, where the system font may lack
them — instead of tofu. A shared pdf_fonts.dart centralizes the PDF theme and
the three label/catalog/recovery services reuse it.

Add Japanese (ja) as the CJK reference locale — fittingly, the app's own name
is Japanese (種, tane, 'seed'). Core strings translated; the rest fall back to
English via slang. Wired into supportedLocales (automatic) and the settings
picker.

Fix three physical Alignment.centerLeft -> AlignmentDirectional.centerStart in
variety_detail_screen, and make month-abbreviation and avatar-initial
truncation grapheme-safe (.characters) so CJK text is never cut mid-character.

Tests: CJK/Arabic PDF glyph render, ja locale resolution + English fallback.
The chat-bubble mirroring flagged by the audit was verified correct (already
respects Directionality) and left unchanged.
This commit is contained in:
vjrj 2026-07-14 11:11:19 +02:00
parent fe4591d747
commit 7ae6becd8f
31 changed files with 686 additions and 104 deletions

View file

@ -146,13 +146,26 @@ flutter:
# Remove before shipping if you don't want them in the bundle.
- assets/ocr_fixtures/
# Embedded in generated PDFs (printable catalog). DejaVu covers Latin
# (extended), Cyrillic and Greek; like the OCR packs, PDF fonts are a
# per-locale resource — swap in wider coverage (Arabic, CJK) as locales
# land. Free license (Bitstream Vera / public domain additions).
# (extended), Cyrillic and Greek; Noto Arabic + Noto CJK ride alongside as
# per-glyph fallbacks so RTL and CJK text render instead of tofu. Fonts are
# a per-locale resource, extensible to any script. Licenses: DejaVu
# (Bitstream Vera / public domain), Noto (SIL OFL 1.1). See assets/fonts/.
- assets/fonts/DejaVuSans.ttf
- assets/fonts/DejaVuSans-Bold.ttf
- assets/fonts/NotoSansArabic.ttf
- assets/fonts/NotoSansJP.ttf
fonts:
# Custom seed-themed icon glyphs (chars ak). See docs/mockups/seedks-glyphs.png.
- family: seedks
fonts:
- asset: fonts/seedks.ttf
# Script coverage fallbacks for the UI text theme (see ui/theme.dart). Noto
# (SIL OFL 1.1) covers Arabic (RTL) and CJK (Japanese kanji/kana + shared
# Han) so those scripts render on every platform, including desktop where
# the system font may lack them. Variable fonts; Flutter picks the weight.
- family: Noto Sans Arabic
fonts:
- asset: assets/fonts/NotoSansArabic.ttf
- family: Noto Sans JP
fonts:
- asset: assets/fonts/NotoSansJP.ttf