Repository navigation
fix(locale): fall back when default translation is empty string - #15069
Conversation
Empty keys in locale JSON (e.g. emails.recovery.subject) were returned as-is and caused mail workers to fail on Template::fromString. Prefer non-empty fallback locale values instead. Fixes CLOUD-3QX0 Co-authored-by: Chirag Aggarwal <[email protected]>
|
Review complete. No issues found — approved ✅. This change refines translation lookup in
Reviewed commit: 8262340 |
🟢 Tier S · Ready to merge
📂 Walkthrough · 2
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What does this PR do?
Several locale JSON files define keys such as
emails.recovery.subjectas empty strings.Locale::getText()treated those keys as present and returned"", so password-recovery (and similar) mails were queued with an empty subject and theworker.mailsjob failed inTemplate::fromString(CLOUD-3QX0).This change treats empty (and null) default-locale values as untranslated: use the fallback locale’s non-empty value when available, otherwise keep the existing dynamic/custom default and missing-key exception behavior. Translation files are unchanged.
Test Plan
testEmptyDefaultLocaleValueUsesFallbackinpackages/locale/tests/LocaleTest.php.testRecoverySubjectFromTranslationFilesWithEmptyLocale, which loadsen.json+bg.jsonand assertsemails.recovery.subjectis non-empty with English fallback text.bin/monorepo test locale.Fixes CLOUD-3QX0
Related PRs and Issues
Checklist
Related: appwrite-labs/cloud#5938