Currently active locale code.
Returns all available locale codes.
Merge translation files from one or more directory paths into the current resources. Later paths override earlier paths when the same key exists in multiple sources. Triggers re-render of all consumers.
Only merges languages whose JSON files exist in the provided paths; other languages are unaffected.
Array of directory paths, each containing {locale}.json files.
Applied in order: later paths win on key conflicts.
Dynamically update the default context for all t() calls.
Pass undefined to clear the default context, restoring the original
behaviour where only the bare key is looked up.
Switch to a different language. Triggers re-render of all consumers.
Translate a key to the current language.
Dot-separated nested keys are resolved via the flat key map
(e.g. menu.title finds the key "menu.title" in the JSON).
// Simple key
t('hello') → 'Hello'
// Parameter interpolation
t('welcome', { params: { name: 'Alice' } }) → 'Welcome, Alice'
// Context-based lookup (e.g. gendered forms)
// Resources: { 'greeting': 'Hello', 'greeting.female': 'Hello, madam' }
t('greeting', { context: 'female' }) → 'Hello, madam'
t('greeting', { context: 'unknown' }) → 'Hello' (fallback)
// Context + interpolation
// Resources: { 'welcome.female': 'Welcome, Ms. {name}' }
t('welcome', { context: 'female', params: { name: 'Alice' } }) → 'Welcome, Ms. Alice'
Missing keys resolve to the key string itself.
Value provided by LanguageProvider via React context. Accessed via the useI18n hook.