Skip to content

Add Vietnamese localization end-to-end and harden email translation fallback#55

Merged
dsanchezcr merged 3 commits into
mainfrom
copilot/add-vietnamese-language-support
Jun 10, 2026
Merged

Add Vietnamese localization end-to-end and harden email translation fallback#55
dsanchezcr merged 3 commits into
mainfrom
copilot/add-vietnamese-language-support

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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

    • Added src/lib/translations/vi.ts with Vietnamese translations for UI flows, guides, and privacy content.
    • Registered vi in src/lib/translations/index.ts.
    • Extended frontend language model/options in src/lib/types.ts (Language + LANGUAGES entry for Vietnamese).
  • Backend language model + parity

    • Extended API Language union in api/src/shared/types.ts to include vi (and keep parity with existing frontend language set).
  • Email localization robustness

    • Updated email template lookup in api/src/shared/email-service.ts to use a centralized fallback resolver, so unsupported/new languages resolve to English template content instead of relying on per-template assumptions.
  • Translation docs

    • Updated src/lib/translations/README.md language list to include Vietnamese.
  • Focused regression coverage

    • Added API test in api/src/__tests__/email-service.test.ts validating Vietnamese email generation falls back to English content deterministically.
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}"`)
  }
  return translation
}

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
Copilot AI requested a review from dsanchezcr June 10, 2026 22:12
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://ashy-rock-03051ee0f-55.eastus2.7.azurestaticapps.net

@dsanchezcr dsanchezcr marked this pull request as ready for review June 10, 2026 22:30
Copilot AI review requested due to automatic review settings June 10, 2026 22:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 vi in the frontend translation registry.
  • Extended both frontend and API Language unions (and frontend LANGUAGES options) to include Vietnamese.
  • Centralized backend email template translation lookup via a getTranslation helper (English fallback) and added a regression test covering vi fallback 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}"`)
}
@dsanchezcr dsanchezcr merged commit 1954cab into main Jun 10, 2026
18 checks passed
@dsanchezcr dsanchezcr deleted the copilot/add-vietnamese-language-support branch June 10, 2026 22:35
@github-actions

Copy link
Copy Markdown

🧹 Preview Environment Cleaned Up

Resource group ZavaGiftExchange-pr-55 is being deleted.

All Azure resources for this PR have been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Vietnamese language as part of the translations

3 participants