Course contentsShow
← JavaScript
Lesson 2251 of 2,72346. InternationalizationFree lesson

Limitations of Built-ins: No Message Translation

Understand that Intl doesn't handle pluralization of full sentences or dynamic message interpolation well.

Limitations of Built-ins: No Message Translation

You'll learn where JavaScript's built-in Intl APIs hit their limits and when you need external tools.

The Core Problem

The Intl APIs you've learned—NumberFormat, DateTimeFormat, RelativeTimeFormat, PluralRules, ListFormat, and DisplayNames—are powerful for formatting data according to locale. They handle numbers, dates, plurals, and lists beautifully. But they cannot translate full messages or handle dynamic sentence construction with proper grammar.

Consider a real-world app message: "You have 3 new messages from Alice, Bob, and Charlie in the last 2 days."

This requires:

  • Pluralizing "message" based on count
  • Translating the entire sentence structure into another language
  • Interpolating values (3, names, 2, "days") correctly
  • Maintaining grammatical agreement that varies by language

While you can use PluralRules to choose "message" vs "messages" in English, and ListFormat to render the names, the sentence template itself must come from somewhere. Intl provides no mechanism to store or retrieve translated strings.

What's Missing

  • No message catalog: Intl doesn't store translations like "Hello" → "Bonjour"
  • No interpolation logic: Inserting dynamic values into translated templates while respecting word order differences across languages
  • No gender/case handling: Many languages inflect words based on context (subject gender, grammatical case)

The Analogy

Think of Intl as a formatter (like a pretty printer), not a translator (like a dictionary). It styles your data correctly for each locale, but it can't teach you how to say things in different languages.

Key Takeaway:
JavaScript's Intl APIs excel at locale-aware formatting but cannot translate messages or handle complex sentence interpolation—you'll need libraries like i18next or FormatJS for full internationalization.