Development

Namespace

A way to organize translation keys into logical groups (auth, common, errors).

Definition

Namespaces in i18n are a way to organize translation keys into logical, modular groups. Instead of one massive translation file, you split translations by feature (auth, checkout), component, or page. This enables lazy-loading translations on demand, reduces bundle size, and makes maintenance easier. Common namespaces include: common (shared text), auth (login/signup), errors (error messages).

Examples

  • common.json: buttons, labels, validation messages used everywhere
  • auth.json: login, signup, password reset text
  • checkout.json: cart, payment, shipping translations
  • Loading: i18next.loadNamespaces(['checkout']) when user visits cart

Frequently Asked Questions

How should I split namespaces?

Common patterns: 1) By feature/module: auth, checkout, settings 2) By page: home, dashboard, profile 3) By type: common, errors, validation. Start with 'common' for shared text, then add feature namespaces. Don't over-split—5-10 namespaces is typical.

Do all i18n libraries support namespaces?

Most major libraries support namespaces: i18next, next-intl, vue-i18n, FormatJS. Implementation varies—some use file-based namespaces, others configure them explicitly. Check your library's documentation.

Related Terms

Ready to simplify your i18n workflow?

Start managing translations with IntlPull.

    Namespace - Definition & Examples | IntlPull Glossary | IntlPull