Add Vietnamese localization end-to-end and harden email translation fallback#55
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add Vietnamese language to localization feature
Add Vietnamese localization end-to-end and harden email translation fallback
Jun 10, 2026
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://ashy-rock-03051ee0f-55.eastus2.7.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR adds Vietnamese (vi) as a first-class language across the frontend and backend type models, and hardens backend email template resolution so newly-added/unsupported languages reliably fall back to English rather than producing missing-template behavior.
Changes:
- Added full Vietnamese UI/guide/privacy translations and registered
viin the frontend translation registry. - Extended both frontend and API
Languageunions (and frontendLANGUAGESoptions) to include Vietnamese. - Centralized backend email template translation lookup via a
getTranslationhelper (English fallback) and added a regression test coveringvifallback behavior.
Show a summary per file
| File | Description |
|---|---|
src/lib/types.ts |
Adds vi to the frontend Language union and language picker options. |
src/lib/translations/vi.ts |
Introduces Vietnamese translation dictionary for the UI and guide/privacy content. |
src/lib/translations/README.md |
Documents Vietnamese as an available translation file. |
src/lib/translations/index.ts |
Registers vi in the exported translations map. |
api/src/shared/types.ts |
Extends backend Language union to include vi (and keep parity with frontend). |
api/src/shared/email-service.ts |
Adds a centralized translation resolver with English fallback and uses it across email generators. |
api/src/__tests__/email-service.test.ts |
Adds a unit test asserting Vietnamese email generation falls back to English deterministically. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 1
Comment on lines
+18
to
22
| function getTranslation<T>(translations: Partial<Record<Language, T>>, language: Language): T { | ||
| const translation = translations[language] ?? translations.en | ||
| if (!translation) { | ||
| throw new Error(`English email translation is missing for language "${language}"`) | ||
| } |
🧹 Preview Environment Cleaned UpResource group All Azure resources for this PR have been removed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds Vietnamese (
vi) to the localization surface and ensures the app remains functional when backend email templates are not yet translated for a newly added language. Scope covers UI/guide/privacy content, language models, and email-template resolution behavior.Frontend localization surface
src/lib/translations/vi.tswith Vietnamese translations for UI flows, guides, and privacy content.viinsrc/lib/translations/index.ts.src/lib/types.ts(Language+LANGUAGESentry for Vietnamese).Backend language model + parity
Languageunion inapi/src/shared/types.tsto includevi(and keep parity with existing frontend language set).Email localization robustness
api/src/shared/email-service.tsto use a centralized fallback resolver, so unsupported/new languages resolve to English template content instead of relying on per-template assumptions.Translation docs
src/lib/translations/README.mdlanguage list to include Vietnamese.Focused regression coverage
api/src/__tests__/email-service.test.tsvalidating Vietnamese email generation falls back to English content deterministically.