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

Built-in Coverage: Numbers, Dates, and Lists

Understand which use cases the Intl API handles well: formatting currencies, dates, relative time, and lists.

Built-in Coverage: Numbers, Dates, and Lists

You'll learn which internationalization tasks the Intl API excels at solving without external libraries.

What the Intl API Handles Best

Think of the Intl API as a specialized toolkit for common internationalization (i18n) needs. It's built into JavaScript specifically to handle tasks that vary dramatically across languages and regions—tasks that would otherwise require complex lookup tables and cultural knowledge.

Core Strengths

The Intl API covers four major areas exceptionally well:

1. Currency and Number Formatting (Intl.NumberFormat)
Handles decimal separators, grouping, currency symbols, percentages, and units. Different locales use different conventions—commas vs periods, symbol placement, spacing—and NumberFormat manages all this automatically.

2. Date and Time Display (Intl.DateTimeFormat)
Manages date ordering (MM/DD vs DD/MM), month names, time zones, 12/24-hour formats, and relative time expressions like "yesterday" or "in 3 days." What seems simple in one language becomes complex across 100+ locales.

3. List Formatting (Intl.ListFormat)
Joins arrays naturally: "apples, oranges, and bananas" (English) vs "pommes, oranges et bananes" (French). The conjunctions, commas, and word order change by language.

4. Localized Names (Intl.DisplayNames)
Converts codes (like "USD" or "en-US") into human-readable names appropriate for each locale.

What It Doesn't Handle

The Intl API doesn't manage full text translation, content management, or dynamic message composition with variables. For those, you'd need a library like i18next or FormatJS.

Key Takeaway: The Intl API provides robust, built-in coverage for formatting numbers (including currencies), dates/times, relative time, and lists—the foundation of most i18n display needs without requiring external dependencies.