Skip to content

Internationalisation (i18n) #840

Description

@DokaIzk

Title: feat: add i18n support with English and Spanish locales using next-intl

Labels: frontend i18n feature
Complexity: medium
Branch: feat/i18n
Depends on: FE-1


Problem Context

Stellar's ecosystem is global, with significant developer communities in Latin America, Europe, and Asia. Hardcoded English strings make SoroScan inaccessible to non-English speakers and prevent community-contributed translations. Establishing an i18n foundation early is far cheaper than retrofitting it after all UI copy is locked in.


Scope

Included:

  • next-intl integration with Next.js App Router
  • Locale routing: /en/... and /es/... (default locale: en, no prefix)
  • Translation files for English and Spanish covering all static UI strings
  • Language selector in the navigation bar
  • LocaleProvider context for client components
  • Document <html lang="..."> attribute updated per locale

Not included:

  • RTL language support (Arabic, Hebrew) — Phase 2
  • Dynamic content translation (event payloads remain as-is)
  • Machine translation CI pipeline

Implementation Guidelines

Files to create/update:

  • src/i18n.tsnext-intl config
  • messages/en.json — English translations
  • messages/es.json — Spanish translations
  • src/middleware.ts — locale detection middleware
  • src/app/[locale]/layout.tsx — wrap with NextIntlClientProvider
  • src/components/ui/LanguageSelector.tsx — dropdown in navbar

Translation file structure:

// messages/en.json
{
  "nav": {
    "events": "Events",
    "contracts": "Contracts",
    "webhooks": "Webhooks",
    "docs": "Docs"
  },
  "events": {
    "title": "Contract Events",
    "empty": "No events found for this contract.",
    "filter": {
      "label": "Filter by type",
      "placeholder": "e.g. transfer"
    }
  }
}

Constraints:

  • All user-visible strings must use useTranslations() — no hardcoded English in JSX
  • Locale preference stored in a cookie for server-side rendering
  • Missing translations must fall back to English, never throw

Acceptance Criteria

  • next-intl configured and all static UI strings extracted to messages/en.json
  • Spanish translation covers 100% of English keys
  • Language switcher in navbar switches locale without full page reload
  • <html lang="..."> attribute reflects the active locale
  • next build succeeds with no missing translation warnings
  • Document contributor guide for adding new translations


Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions