Skip to content

feat: integrate GLOBAL-1 multilingual website foundation#114

Draft
support371 wants to merge 28 commits into
mainfrom
feat/global-1-multilingual-integration
Draft

feat: integrate GLOBAL-1 multilingual website foundation#114
support371 wants to merge 28 commits into
mainfrom
feat/global-1-multilingual-integration

Conversation

@support371

@support371 support371 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a non-breaking multilingual foundation to the existing GEM Enterprise Next.js application while preserving the current public routes, authentication, KYC, admin, and client portal architecture.

Implemented

  • English source locale with Spanish, French, German, and Arabic dictionaries
  • Arabic right-to-left document direction
  • Cookie-based locale persistence with browser-language fallback
  • Validated /api/locale preference endpoint
  • Localized mobile-first global navigation and footer
  • Accessible desktop and mobile language selectors
  • General Translation gt.config.json
  • Dictionary key, direction, and placeholder validation
  • Manual General Translation workflow that opens a translation PR
  • CI validation before production deployment
  • Environment-variable and operational documentation
  • Rollback path that preserves the original navigation/footer components

Architecture decision

Locale prefixes were not added to the existing URLs. This avoids disrupting protected-route redirects, KYC state transitions, portal links, and admin RBAC. The selected locale is resolved server-side from the gem-locale cookie or the browser Accept-Language header.

Validation status

  • Dictionary key parity was checked across all five locales.
  • Arabic is configured with dir="rtl".
  • A full GitHub Actions build has not yet been observed for this branch.
  • Vercel preview verification is still required before merge.
  • Language review is recommended before production promotion.

Required external configuration

Add these GitHub Actions secrets before running the automated translation workflow:

  • GT_PROJECT_ID
  • GT_API_KEY

Existing Vercel deployment secrets remain required by the production workflow.

Review checklist

  • GitHub Actions validation is green
  • Desktop language selector works
  • Mobile language selector and menu work
  • Locale persists after navigation and refresh
  • Spanish, French, and German labels render correctly
  • Arabic renders right-to-left without layout overflow
  • Protected routes and admin RBAC remain unchanged
  • Vercel preview is verified in all supported languages
  • Translation wording receives human review

This PR is intentionally a draft until CI and preview verification are complete.

Summary by Sourcery

Introduce a cookie- and header-driven multilingual foundation for the GEM Enterprise Next.js app, localizing the global layout shell while preserving existing routes and portals.

New Features:

  • Add locale-aware root layout that sets HTML lang/dir and provides dictionaries via a client I18n context.
  • Introduce localized global navigation and footer components with desktop and mobile language selectors.
  • Expose a validated /api/locale endpoint to persist user language preference in a secure cookie.
  • Add typed i18n configuration, dictionary loading, and server-side locale resolution for five locales.

Enhancements:

  • Update site metadata description and keywords to reflect the integrated GEM Enterprise platform.
  • Add a strict i18n validation script and integrate it into CI to enforce dictionary parity and placeholder consistency.
  • Add documentation describing the multilingual architecture, workflows, and rollback strategy.
  • Add a GitHub Actions workflow to generate translations via General Translation and open review pull requests.

Build:

  • Split the main GitHub Actions workflow into validate and deploy jobs, adding lint, test, build, and i18n validation steps before production deployment.

CI:

  • Introduce a translation-generation GitHub Actions workflow that runs General Translation, validates dictionaries, and opens automated PRs for review.

Deployment:

  • Gate Vercel production deployments on successful validation of multilingual dictionaries and the application build.

Documentation:

  • Document the GLOBAL-1 multilingual integration, runtime flow, translation workflow, deployment expectations, and rollback plan.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Deployment failed with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `_buildNote`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gem-enterprise Error Error Jun 26, 2026 10:50am

@sourcery-ai

sourcery-ai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces a non-breaking multilingual infrastructure for the GEM Enterprise Next.js app, including server-side locale resolution, client-side i18n context, localized global navigation/footer, a validated locale API with cookie persistence, translation workflow automation, and CI i18n validation integrated into the main pipeline.

Sequence diagram for server-side locale resolution and layout rendering

sequenceDiagram
  participant Browser
  participant RootLayout
  participant getRequestLocale
  participant getDictionary
  participant I18nProvider
  participant GlobalNavigation
  participant GlobalFooter

  Browser->>RootLayout: HTTP request
  RootLayout->>getRequestLocale: getRequestLocale()
  getRequestLocale->>cookies: cookies()
  getRequestLocale->>headers: headers()
  getRequestLocale-->>RootLayout: locale
  RootLayout->>getDictionary: getDictionary(locale)
  getDictionary-->>RootLayout: dictionary
  RootLayout->>I18nProvider: render I18nProvider locale,dictionary
  I18nProvider-->>GlobalNavigation: useI18n()
  I18nProvider-->>GlobalFooter: useI18n()
  RootLayout-->>Browser: HTML with html.lang, html.dir
Loading

Sequence diagram for client-side language change via /api/locale

sequenceDiagram
  actor User
  participant LanguageSwitcher
  participant LocaleApi as api_locale_route
  participant NextResponse
  participant Router as next_navigation_router

  User->>LanguageSwitcher: select new locale
  LanguageSwitcher->>LanguageSwitcher: changeLocale(nextLocale)
  LanguageSwitcher->>LocaleApi: fetch("/api/locale", POST, { locale })
  LocaleApi->>LocaleApi: localeSchema.safeParse(payload)
  alt invalid locale or JSON
    LocaleApi-->>LanguageSwitcher: 400 { ok:false, error }
    LanguageSwitcher->>LanguageSwitcher: setError("Language update failed")
  else valid locale
    LocaleApi->>NextResponse: NextResponse.json({ ok:true, locale })
    NextResponse->>NextResponse: cookies.set(LOCALE_COOKIE)
    NextResponse-->>LanguageSwitcher: 200 { ok:true, locale }
    LanguageSwitcher->>document: update documentElement.lang, documentElement.dir
    LanguageSwitcher->>Router: router.refresh() (startTransition)
  end
Loading

File-Level Changes

Change Details Files
Add core i18n configuration, types, server helpers, and locale dictionaries with English fallback and RTL support.
  • Define supported locales, cookie settings, direction helpers, and Accept-Language matching utilities.
  • Add a server-only helper to resolve the request locale from cookies or headers.
  • Introduce a typed Dictionary schema and dictionary loader that merges non-English partial dictionaries over the English source with meta and footer/common sections.
  • Add initial JSON dictionaries for English, Spanish, French, German, and Arabic with meta data and navigation/footer labels.
src/i18n/config.ts
src/i18n/server.ts
src/i18n/types.ts
src/i18n/get-dictionary.ts
src/i18n/dictionaries/en.json
src/i18n/dictionaries/es.json
src/i18n/dictionaries/fr.json
src/i18n/dictionaries/de.json
src/i18n/dictionaries/ar.json
Introduce a client-side i18n provider and language switcher wired to a validated locale API that persists the selected locale in a cookie and updates document direction.
  • Add a React context provider exposing the active locale and dictionary to client components with a safety-checked hook.
  • Implement an accessible language switcher that posts a validated locale to the locale API, updates document lang/dir, and triggers a router refresh while handling pending state and errors.
  • Expose locale options and direction helpers from shared i18n config for use by client components.
src/components/I18nProvider.tsx
src/components/LanguageSwitcher.tsx
src/i18n/config.ts
src/app/api/locale/route.ts
Replace the existing navigation and footer with localized, mobile-first GlobalNavigation and GlobalFooter components that consume the i18n context.
  • Implement a new responsive GlobalNavigation with desktop and mobile layouts, translated labels from the dictionary, active-route highlighting, and integrated language switcher.
  • Implement a new GlobalFooter that renders platform, company, legal, and client-access link columns with translated labels and a localized qualified-clients notice.
  • Wire navigation/footer labels through dictionary.navigation.labels and dictionary.footer fields, keeping labels keyed in English while translated via dictionaries.
src/components/GlobalNavigation.tsx
src/components/GlobalFooter.tsx
src/components/I18nProvider.tsx
src/i18n/dictionaries/*.json
Integrate the multilingual shell into the RootLayout so that locale and direction are resolved server-side without changing existing routes or portal behavior.
  • Update RootLayout to resolve the locale using getRequestLocale, load the merged dictionary, and wrap the app in I18nProvider.
  • Set the html lang and dir attributes dynamically using the resolved locale and getDirection while preserving existing Providers, analytics, and portal detection.
  • Swap the previous Navigation/Footer usage for GlobalNavigation/GlobalFooter, keeping skip-link behavior and non-portal layout structure intact.
  • Slightly adjust metadata description and keywords to the new product description.
src/app/layout.tsx
Add CI i18n validation and a General Translation workflow that validates dictionaries and opens translation pull requests, and refactor the main CI/CD pipeline to separate validation from deployment.
  • Introduce a TypeScript i18n validation script that checks dictionary presence, key parity against the English source, placeholder consistency, and meta direction/locale correctness, with strict-mode support.
  • Add a GitHub Actions workflow to generate translations via General Translation, validate them, and open a dedicated PR if dictionary changes are detected.
  • Refactor the main GitHub Actions workflow to add a validate job (including i18n validation, lint, test, and build) that runs on pushes and PRs, and gate the production deploy job on successful validation and non-PR main-branch pushes.
scripts/validate-i18n.ts
.github/workflows/i18n-translate.yml
.github/workflows/main.yml
gt.config.json
Document the multilingual architecture, runtime flow, translation workflow, and rollback strategy.
  • Add a detailed MULTILINGUAL_INTEGRATION.md describing supported locales, runtime locale resolution, file layout, translation workflow using General Translation, deployment sequence, and rollback steps.
  • Update environment/example configuration or docs to mention required GT_* secrets and how they integrate with existing deployment workflows.
docs/MULTILINGUAL_INTEGRATION.md
.env.example

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
gem-enterprise 918dfa4 Jun 26 2026, 11:19 AM

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.

1 participant