Core API

Translation (t)

The t() function resolves a dot-notation key from the active locale's messages and returns the translated string.

ts
i18n.t('profile.greeting', { name: 'Ana' });
i18n.t('cart.items', { count: 3 });
i18n.exists('profile.greeting');

Key points

  • t(key, params) returns a string.
  • Missing keys can fall back to base messages before returning the key.
  • exists(key) is useful for optional UI branches.

Next step

Copy the example into a small fixture, run the validation commands, and keep framework-specific routing, hydration, or SSR behavior covered by your app tests.