Repository navigation
Description
Context
use-intl expects nested JSON objects representing namespaces (e.g. useTranslations('auth') accessing key signIn). FloCafe's current translation files contain 2,053 flat dotted keys ("auth.signIn": "Sign In").
This issue performs a purely mechanical, deterministic data transformation from flat dot-notation to nested JSON objects across all 4 locale files.
Current State
4 translation files in frontend/src/lib/i18n/messages/ with 2,053 flat keys each:
en.json(canonical schema)es.jsonpt.jsonfa.json
What to do
1. Collision Detection & Resolution
Before conversion, run an automated check to verify that no key path conflicts with an ancestor object (for example, having both "a": "..." and "a.b": "..." would cause a collision in a nested structure). If any collision exists, document and resolve it explicitly.
2. Deterministic Nesting Conversion
Convert all 4 JSON files mechanically:
Before (flat):
{
"auth.email": "Email",
"auth.signIn": "Sign In",
"orders.pending": "Pending",
"orders.preparing": "Preparing"
}After (nested):
{
"auth": {
"email": "Email",
"signIn": "Sign In"
},
"orders": {
"pending": "Pending",
"preparing": "Preparing"
}
}3. Update Compatibility Adapter
Update t(key, lang, params) in frontend/src/lib/i18n.ts to resolve dotted paths by traversing nested message objects (e.g. key.split('.').reduce(...)), ensuring legacy callers passing "auth.signIn" continue to receive expected strings.
4. Update Equivalence & Translation Tests
Update tests/translations.test.ts to recursively traverse nested leaf nodes when validating key parity across en, es, pt, and fa. Ensure equivalence tests verify that every old dotted key resolves to the exact same value in the new nested structure.
What NOT to do
- Do NOT change any translation wording or copy.
- Do NOT add new translation keys or delete existing ones.
- Do NOT introduce ICU features (
select, rich text) during this data conversion. - Do NOT migrate components from
useI18ntouseTranslations. - Do NOT remove the compatibility adapter.
- Do NOT keep duplicate flat files around permanently.
Acceptance Criteria
- All 4 message files in
frontend/src/lib/i18n/messages/converted to valid nested JSON. - 100% leaf key parity maintained across all locales (exact count and values preserved).
- Compatibility adapter in
i18n.tsresolves dotted paths against nested message objects. -
tests/translations.test.tsupdated and passing with nested message schema.
Verification
npm run test:translations
npm run lint
npm run build:frontend
npm test
Activity
khaira777 commentedon Aug 19, 2026
Implemented, stacked on #373. The no-mistakes pipeline is running (
--yesauto-fix; review already passed with 0 findings, i18n tests in progress) and will create the PR automatically.What landed:
en/es/pt/fa) from flat dotted keys to nested JSON — 2,053 leaves each, round-trip verified (no value or key changes).t()infrontend/src/lib/i18n.tsto resolve dotted keys by traversing the nested message tree (target language → English → raw-key fallback), so every legacyt('auth.signIn')caller keeps working.tests/translations.test.tsto flatten nested leaves for parity/validation and scope duplicate-key detection per object.tests/e2e-argentina-flow.test.tskey extractor for nested JSON.Notes:
t()adapter is kept.Leaving this issue open for review/merge.
refactor(i18n): convert flat translation keys to nested message format (
khaira777 commentedon Aug 19, 2026
✅ Done — merged as
9236866via PR #396Flat → nested message conversion complete across
en,es,pt,fa(2,053 leaves each, 26 namespaces, max depth 4; round-trip verified, no wording/key changes, no collisions).i18n.tst()resolves dotted keys viaresolveMessage()traversal (target lang → English → raw-key fallback).tests/translations.test.tsupdated withflattenLeaves()parity + scopedfindDuplicateKeys().tests/e2e-argentina-flow.test.tsextractJsonKeys()now recursive over nested JSON.This unblocked #382 (the validation gate), which merged next. Closing.
khaira777 commentedon Aug 19, 2026
Closed as completed.