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

When You Don't Need Translation Libraries

Recognize scenarios where Intl plus object lookups can handle multiple languages without i18next or similar tools.

When You Don't Need Translation Libraries

You'll learn: When basic internationalization needs can be met using the built-in Intl API and simple object lookups, without pulling in heavyweight translation frameworks.

The Lightweight Alternative

Translation libraries like i18next, react-intl, or FormatJS are powerful but add significant bundle size and complexity. For many projects, especially those with limited translation needs, you can handle multiple languages using just the Intl API combined with plain JavaScript objects.

When Simple Object Lookups Work

If your app has:

  • A small number of static strings (buttons, labels, messages)
  • Already using Intl for numbers, dates, and formatting
  • No complex pluralization beyond what Intl.PluralRules handles
  • No variable interpolation in the middle of sentences

...you can store translations in simple objects:

const translations = {
  en: { welcome: 'Welcome', items: 'items' },
  es: { welcome: 'Bienvenido', items: 'artículos' },
  fr: { welcome: 'Bienvenue', items: 'articles' }
};

const locale = 'es';
const t = translations[locale];

console.log(t.welcome); // "Bienvenido"

// Combine with Intl for dynamic data
const count = 5;
const formatted = new Intl.NumberFormat(locale).format(count);
console.log(`${formatted} ${t.items}`); // "5 artículos"

The Sweet Spot

This approach shines when you're mostly internationalizing formatted data (dates, numbers, lists) and only need to translate a handful of UI labels. Think of it like using a dictionary instead of hiring a full-time translator—perfectly adequate for tourist phrases, but you'd want the professional for writing a novel.

Key Takeaway: For apps with limited static text and heavy reliance on Intl formatting, simple translation objects can replace full i18n libraries, keeping your bundle lean and dependencies minimal.