Referencei18n
useTranslator
React hook that returns the typed translator for the nearest I18nProvider
Import
useTranslator returns the translator from the nearest I18nProvider. Control components pass text descriptors from core getLabel(). Custom UI can pass an opaque key with its English fallback.
When no provider is mounted, the hook falls back to English registry strings so standalone demos do not throw.
Example
Switch the provider locale to see useTranslator resolve a simple key and a parameterized key from the nearest provider.
- Button
- Reproducir
- Parameterized
- Adelantar 10 segundos