Skip to content

Search

Articles, tools, solutions and knowledge base guides

Start typing to search across articles, tools and apps.

Frontend Internationalization (i18n): How to Design Multilingual Applications

A shop serving Poland and Germany needs more than a translated Buy button. A price may still be in euros, delivery depends on the market, and the interface language does not determine the time zone. Internationalization separates these decisions from business logic. This guide explains how to choose an architecture and avoid mistakes when expanding to additional languages.

Published Written by Reading time 17 min read
On this page Contents: quick navigation between sections

i18n, l10n and locale: separate responsibilities

Internationalization (i18n) prepares code and interfaces for multiple languages. Localization (l10n) adapts content, formats, imagery and experience to an audience. A locale such as pl-PL describes language and regional preferences, not a complete business profile. BCP 47 can also express script, as in zh-Hant. [1][2]

A Polish-speaking customer may live in Germany, buy in EUR and use Europe/Berlin. Do not infer currency, taxes, shipping country, permissions or time zone from locale alone. Model market, currency and time zone separately. The backend remains authoritative for prices and sales rules.

Language selection and fallback

locale.ts

export const SUPPORTED_LOCALES = ["en", "pl", "de", "pt-BR"] as const;

export type Locale = (typeof SUPPORTED_LOCALES)[number];

const DEFAULT_LOCALE: Locale = "en";
const supported = new Set<string>(SUPPORTED_LOCALES);

function isSupported(value: string): value is Locale {
  return supported.has(value);
}

export function resolveLocale(preferences: readonly string[]): Locale {
  for (const preference of preferences) {
    let canonical: string | undefined;

    try {
      [canonical] = Intl.getCanonicalLocales(preference);
    } catch (error) {
      if (error instanceof RangeError) {
        continue;
      }

      throw error;
    }

    if (canonical === undefined) {
      continue;
    }

    const locale = new Intl.Locale(canonical);

    if (isSupported(locale.baseName)) {
      return locale.baseName;
    }

    if (isSupported(locale.language)) {
      return locale.language;
    }
  }

  return DEFAULT_LOCALE;
}

For public pages, an explicit language in the URL should take priority. On a neutral entry URL, consider a saved preference, ordered Accept-Language preferences and a default. Do not redirect a valid language URL based on browser settings. In an authenticated app, the profile language may take precedence over device defaults. [2][8][10]

The resolver below takes an already ordered preference list, canonicalizes identifiers and allows only four configured locales. It is deliberately limited: it does not parse HTTP headers, q weights or the full language-script-region hierarchy. pt-PT does not automatically become pt-BR. For larger products use a proven negotiation mechanism and define permitted equivalents. Separate locale fallback from individual message fallback; missing mandatory legal content must not be hidden by another market's translation. [2][5][10]

RFC 4647 distinguishes filtering (a set of matching tags) from lookup (one result, progressively truncating the range). ECMA-402 best fit may use additional linguistic knowledge and is implementation-dependent; it is not a business market-selection rule. For zh-Hant-HK, consider zh-Hant before any switch to zh-Hans. Define permitted mappings explicitly. Accept-Language can include q weights, a wildcard and q=0 exclusions. Use an HTTP parser, handle malformed input and define behavior when nothing matches; never pass the entire header to Intl.Locale. [10][22][1]

Intl, numbers, dates and grammar

formatting.ts

import type { Locale } from "./locale.js";

export function createOrderFormatters(locale: Locale, currency: string) {
  const price = new Intl.NumberFormat(locale, {
    style: "currency",
    currency,
  });

  const quantity = new Intl.PluralRules(locale);

  return { price, quantity };
}
Polish plural forms
NumberCLDR categoryExample message
1one1 kilogram
2few2 kilogramy
12many12 kilogramów
22few22 kilogramy
1.5other1,5 kilograma

The Polish weight examples illustrate how grammatical categories affect noun inflection. ICU allows a separate =0 variant, such as “No products”, independently of the many category for zero. The other variant is the required default. [4][6]

Related article: JavaScript Date, Intl and Temporal.

Intl.NumberFormat displays an amount in the supplied currency; it does not convert exchange rates or perform exact financial arithmetic. Store money according to the domain contract, for example in minor units or a decimal type. Intl.DateTimeFormat accepts an explicit time zone, Intl.Collator supports sorting and Intl.Segmenter identifies text segments. Do not parse presentation strings. API support and locale data depend on the runtime. [1][3]

Pluralization is not a choice between one and everything else. Polish uses one, few, many and other (for example 1, 2, 12 and 1.5). A CLDR category is not a translated message. Use complete messages with variants and parameters instead of concatenating fragments. If the displayed value is rounded, align formatting and plural selection options. [1][4]

As of 30 November 2026, CLDR 49 (22 October 2026) is the current stable release. Node.js or browser data can be older. Test actual target runtimes; ECMA-402 conformance does not imply identical CLDR data. [1][34]

Intl.NumberFormat validates currency code structure but does not enforce a product currency allowlist. The example tests distinguish malformed EU from structurally valid XYZ.

Translation catalogs and message formats

Stable semantic keys such as checkout.payment.failed identify intent rather than spelling. Organize catalogs by domain or feature and provide translator context: parameter meaning, length constraints, UI location and screenshots. Do not share keys solely because two source strings are identical; grammar may differ in another language. Typed keys do not replace validation of message syntax and parameters. [5][6][7]

ICU MessageFormat supports complete messages with plural and select. Unicode MessageFormat 2 is a separate standard with different syntax; adopt it after checking parsers, extraction tools, translation platforms and target-language support. Do not assume existing ICU catalogs are compatible or that browsers provide a native MF2 runtime. [6][11][21]

Catalog formats and translation interchange

Formats and their roles
FormatRoleLimitations
JSONApplication catalog, easy Git diffsNo common plural or metadata convention
POgettext catalog, context and plural formsRequires compatible extraction and compilation
XLIFFInterchange with a TMSVerify markup and variants after import
ICU MessageFormatDynamic messages, plural and selectParser and configuration dependencies
Unicode MF2Dynamic message standardDifferent syntax; check runtime, editor and conversion

Storage format and message syntax are different layers. JSON can contain ICU messages; XLIFF can transport them to translators. Test round trips for IDs, arguments, markup, context and translation status. XLIFF 2.1 is an OASIS Standard; 2.2 is a Committee Specification. Validate actual tool versions rather than inferring interoperability from the format number. [23][24][25]

Library and architecture selection

Localization strategies
ApproachAdvantagesLimitationsWhen to choose
Build-timeDistribute ready-made variantsMore artifacts; content updates need a releaseStable site, localized Angular builds
RuntimeLanguage switching and on-demand loadingLoading, errors and catalog compatibilitySaaS, modular applications
HybridCritical text in SSR; smaller initial payloadVersion and hydration coordinationPublic portal with an extensive app
Libraries and selection criteria
ToolStrengthsWatch out for
Intl + catalogsNo additional engine; simple formattingNo sentence translation, extraction or loading
FormatJS / React IntlICU, extraction, rich textCatalog compilation and parser compatibility
i18nextNamespaces, fallback, resource loadingFormat and integration configuration; missing keys
Vue I18nVue integration, interpolation and pluralizationSyntax is not automatically ICU-compatible
Angular i18nExtraction and localized buildsRuntime switching needs a separate approach
next-intlNext.js integration, SSR, routing, ICUTied to Next.js architecture
LinguiExtraction, catalogs and compiled ICU messagesBuild and catalog workflow integration [26]
TranslocoAngular, runtime switching and lazy-loaded scopesCheck loaders, SSR and configuration [27]
Paraglide JSGenerated typed message functions and tree shakingDepends on static references and bundler; some build options are experimental [28]

A small app with a few fixed labels can use catalogs and Intl. In a product with dynamic messages, translators and multiple teams, an established library reduces the cost of maintaining a custom engine. FormatJS provides ICU and extraction, i18next provides namespaces and resource loading, and Vue I18n integrates with Vue. Angular supports localized builds; changing language without reloading requires an explicit mechanism. In Next.js, next-intl supports routing and SSR. [5][6][7][12][13][14]

Build-time localization provides known resources at deployment, at the cost of more artifacts. Runtime localization can fetch catalogs on demand but needs loading states, versioning and failure handling. A hybrid approach includes critical messages in the document and loads feature catalogs later. None guarantees correct translations or accessibility.

Application architecture: from two to 25 languages

Architecture by product type
ProductApproachScaling condition
Small applicationIntl and catalogs or a lightweight librarySingle source of keys; whole messages
Public portalSSR/SSG and distinct URLsMap language counterparts
SaaSRuntime or hybridDomain catalogs and atomic language switch
E-commerceIndependent language, market and currencyBackend owns price and availability
Enterprise / micro frontendsTMS, contracts and domain catalogsCatalog owners and version compatibility
Multi-product monorepoShared i18n infrastructureIndependent catalog releases

Frontend owns interface language, formatting and accessibility. Backend returns data and stable error codes with arguments, enforces market rules and localizes out-of-app messages such as emails. CMS owns content translations and publishing. A TMS (Translation Management System) coordinates translators; CI checks catalog contracts. Do not duplicate these responsibilities. In micro frontends, the host selects locale and domains own catalogs under a shared language-change contract; in a monorepo share infrastructure, not every message. [29]

SSR, hydration and performance

Related article: React Hydration Errors: Causes, Debugging and Fixes.

Resolve locale per server request and pass the same configuration and catalog version to the client. Never mutate a global language instance shared across concurrent requests. The client should not choose a new language from navigator.language before hydration. Even identical locale and time zone can produce different output with different ICU data; preserve initial server text where necessary.

When switching languages, load required catalogs before updating the interface. Commit only the latest request so a late response cannot overwrite a newer choice. Cache catalogs by locale, namespace and version; header-negotiated responses need appropriate Vary or equivalent cache-key separation. Public documents with explicit URLs are easier to cache than cookie-dependent variants. [10][14][15]

Separate first-view messages from feature catalogs such as billing and reports. Measure compressed payload, request count and time to a fully localized interface instead of assuming lazy loading is always faster. Immutable versioned resources can be cached for longer; the current release manifest needs a separate policy. Never put personalized responses in a shared cache. Commit a locale change only once required catalogs are ready. [10][15]

Multilingual SEO

Related article: robots.txt and sitemap.xml: technical SEO guide.

URL strategies
URL structureAdvantagesLimitations
example.com/pl/Shared infrastructure; simpler maintenanceConsistent routing and page mapping
pl.example.comIndependent infrastructure if neededDNS, certificates, sessions and monitoring
example.plStrong country signal, not languageMultiple domain costs; not a substitute for hreflang
example.com?lang=plCan represent a separate URLGoogle advises against parameters as primary localization structure
Cookie without distinct URLPreference in a private appPublic variants harder to index and share

Use separate crawlable URLs such as /pl/cennik and /en/pricing. Map them using stable page IDs, not simple prefix substitution, because slugs may be translated. Add reciprocal hreflang annotations including self-references and optional x-default. Distinct indexable translations should be self-canonical; duplicate same-language regional variants require a separate canonical policy. [8][9]

Do not publish fake alternates, 404s or translations users cannot reach. Hreflang can be supplied through HTML, HTTP headers or sitemaps; choose one maintainable configuration source. Localize titles, descriptions, content and internal links, not just navigation. Google does not use lang or hreflang to detect the language of page content, but lang is important for accessibility. [8][9][16]

Subdirectories usually simplify a new portal; separate domains make sense when market organization requires them. Verify that hreflang targets are directly reachable, indexable, reciprocal and absolute URLs. Do not use x-default as a substitute for missing translations. Migrate URLs with a mapping and redirects to corresponding content. [8][9][30]

RTL, accessibility and security

Related article: Semantic HTML: Accessibility, SEO and Best Practices.

Set document lang and dir, and identify foreign-language passages with lang as required by WCAG. Direction depends on script; use CSS logical properties such as margin-inline-start instead of reversing each element manually. Isolate mixed-direction user content with bdi or dir=auto. Do not automatically mirror logos, digits or playback symbols. Test focus, longer labels, wrapping and narrow layouts. [16][17][18][20]

Treat catalogs as data, not trusted HTML. Interpolate through the safe rendering mechanism for the output context; in React use text nodes or controlled rich-text components. Do not disable escaping without understanding the rendering context or insert catalog content into innerHTML. Validate link destinations separately. Never include secrets in catalogs shipped to the client. [19]

TMS, versioning and AI translation quality

Workflow: extract messages, synchronize with the TMS, translate with context, review, validate and publish artifacts. Git holds the source contract and approved artifacts or their versions; define synchronization direction to avoid overwriting changes. Translation memory stores previous segment pairs, a glossary records approved terms and a style guide defines voice. A changed source message needs renewed review even if its key stays the same. [31][32]

AI and machine translation can draft content; do not automatically approve legal, payment or security messages. Do not send customer data to external models without appropriate authorization and processing safeguards. Protect placeholders and markup, validate syntax and terminology, and arrange review by someone familiar with the language and product. Track approved-message coverage and approval time, not just generated message count.

Quality workflow: extraction to deployment

i18n test matrix
Test areaCaseExpected result
UnitPolish: 1, 2, 12, 22, 1.5; invalid localeCorrect categories and controlled fallback
ContractMissing argument, malformed ICU, changed typeCI rejects incompatible catalog
IntegrationRapid pl → de → en; concurrent SSRLatest choice wins; no locale leakage
E2E / SEONo cookie; direct URL, canonical and hreflangCorrect language, counterparts and HTTP statuses
Visual / accessibilityRTL, long labels, focus, narrow viewportNo clipping; correct lang/dir and keyboard support
RegressionUnavailable catalog, old client and new releaseControlled error message or compatible fallback

In CI, check missing and unused keys, placeholder compatibility and message syntax with the library parser. Unit tests cover locale selection, fallback, pluralization and formatting; integration tests cover language switches, response ordering and SSR. E2E tests check switcher accessibility, document lang/dir, navigation and forms. Visual tests using pseudolocalization and RTL expose layout problems but cannot replace linguistic review.

Tie catalog deployments to application versions. Measure missing messages and load errors by locale and namespace without recording private placeholder values. Set quality gates for payment and legal screens; treat machine or AI translation as material for review, not automatic approval. Verify domain rules and customer support before launching a new market.

A parser validates message syntax, not linguistic correctness. Preserve the parameter and markup contract while allowing translators to reorder elements according to grammar. The matrix below is a product test plan, not results of library integration tests.

Migration and anti-patterns

Anti-patterns and alternatives
Anti-patternConsequenceAlternative
Concatenated sentence fragmentsBroken grammarWhole parameterized message
Global SSR localeLanguages leak between requestsPer-request context
All locales in initial bundleLarger transferSplit by language and domain
Fallback hides every missing keyIncomplete legal contentBlock critical content publication
Country flag as languageAmbiguityLanguage name and optional region
Automatic redirect on every URLLost choice and SEO problemsNegotiate only at neutral entry

Stage 1: inventory text, formatting and market dependencies; define a locale contract and source language. Stage 2: migrate one complete feature, such as settings, and test a second language with different grammar. Stage 3: introduce domain catalogs, extraction and CI; add RTL or pseudolocalization before scaling language count. Stage 4: as coordination costs grow, introduce TMS, catalog owners and market-specific release gates. Migrate public URLs with their counterpart mapping. Do not build a custom engine up front or replace a proven library simply because a new standard exists. [33]

Start with platform standards, choose a simple catalog architecture and adopt a library that fits your product. Adding a language should extend an existing contract rather than require business logic changes across dozens of components.

Tools for this topic

Internationalization i18n Localization Intl Unicode CLDR MessageFormat SSR SEO Accessibility TypeScript

Frequently asked questions

Does Intl replace an i18n library?

No. It formats data and selects grammatical categories but does not manage catalogs, sentence translation or routing. [1][6]

Does language determine currency?

No. Currency belongs to the price contract; locale affects presentation. [1]

Do authenticated applications require hreflang?

Not for non-indexable views. It is useful for public language equivalents. [9]

Should fallback always be English?

No. It depends on the product, content type and market requirements. Missing critical translations should block publication.

Should we migrate from ICU to MF2?

Only when requirements justify it and the entire translation workflow and runtime are compatible. [6][11]

Do I need a TMS from day one?

No. Git and CI may suffice for a few languages and one team. TMS helps parallel translation, context, review and reuse.

Should each language have a separate domain?

Not by default. Country domains target markets, not just languages. A shared domain with subdirectories often simplifies maintenance. [8]

Can AI translations be published automatically?

Only under defined risk and review policies. Critical messages need approval; syntax and arguments must pass automated checks.

Sources and references

  1. ECMA-402, ECMAScript 2026 Internationalization API (13th edition)↩1↩2↩3↩4↩5↩6↩7↩8
  2. W3C, Choosing a language tag (BCP 47)↩1↩2↩3
  3. MDN, JavaScript internationalization↩1↩2
  4. Unicode CLDR 49, Language Plural Rules↩1↩2↩3
  5. i18next, Fallback↩1↩2↩3
  6. FormatJS, Intl MessageFormat↩1↩2↩3↩4↩5↩6
  7. Vue I18n, Message format syntax↩1↩2
  8. Google Search Central, Managing multi-regional and multilingual sites↩1↩2↩3↩4↩5↩6↩7
  9. Google Search Central, Localized versions of pages↩1↩2↩3↩4↩5
  10. IETF RFC 9110, HTTP Semantics (Accept-Language and Vary)↩1↩2↩3↩4↩5
  11. Unicode, MessageFormat 2↩1↩2
  12. Angular, Internationalization overview↩
  13. next-intl, Internationalization for Next.js↩
  14. next-intl, Routing configuration↩1↩2
  15. i18next, Namespaces↩1↩2↩3
  16. W3C WAI, WCAG 2.2: Language of parts↩1↩2
  17. W3C, Authoring HTML: Handling right-to-left scripts↩
  18. MDN, CSS logical properties and values↩
  19. i18next, Security notes↩
  20. W3C WAI, WCAG 2.2: Language of page↩
  21. Unicode UTS #35, Part 9: MessageFormat↩
  22. IETF RFC 4647, Matching of Language Tags↩
  23. OASIS, XLIFF 2.1 Standard↩
  24. OASIS, XLIFF 2.2 Core Committee Specification↩
  25. GNU gettext, PO Files↩
  26. Lingui, Introduction and core concepts↩
  27. Transloco, Scope Configuration↩
  28. Paraglide JS, Compiling Messages↩
  29. Microsoft Learn, Globalization roles and responsibilities↩1↩2
  30. Google Search Central, Canonical URLs↩
  31. Microsoft Learn, Maintain translation memories↩
  32. Microsoft Learn, Manage terminology↩
  33. Microsoft Learn, Pseudolocalization↩
  34. Unicode, CLDR 49 Release Note (2026-10-22)↩

Was this helpful?

Get new articles by email

One short email per new Learning article. No spam, unsubscribe in one click.

We only use your email to send new articles. No third-party sharing.

Back to Learning