ConstRegular expression for matching component placeholders in translation strings. Matches patterns like <0>text</0> or text for safe HTML rendering.
Regular expression for matching variable placeholders in translation strings. Matches patterns like ${variableName} for dynamic content substitution.
Creates an enhanced translation function that supports both simple translations and component-based translations for safe HTML rendering.
The namespace prefix for translations
The loaded translation data
Optionaloverrides: Record<string, unknown>Optional override translations that take precedence
An enhanced translation function with Trans component support
Creates a translation function for a specific namespace with optional overrides.
The namespace prefix for translations (e.g., 'mfa', 'common')
The loaded translation data
Optionaloverrides: Record<string, unknown>Optional override translations that take precedence
A translation function scoped to the specified namespace
Retrieves a nested value from an object using dot notation path traversal.
The object to traverse
Dot-separated path to the desired value (e.g., 'common.errors.required')
The value at the specified path, or undefined if not found
Loads translation data for a specific language from the translations directory.
The language code to load (e.g., 'en-US', 'es-ES')
Optionalcache: Map<string, LangTranslations | null>Optional cache map to store loaded translations
Promise resolving to translation data or null if not found
Loads translations with automatic fallback support for missing languages.
The primary language to load
OptionalfallbackLanguage: stringOptional fallback language if primary fails
Optionalcache: Map<string, LangTranslations | null>Optional cache map to store loaded translations
Promise resolving to translation data with fallback support
Parses a translation string with component placeholders and returns structured data for safe rendering without dangerouslySetInnerHTML.
The translation string with component placeholders like <0>text</0>
Optionalcomponents: TranslationElementsObject mapping component keys to React elements or render functions
Array of strings and React elements for safe rendering
Performs variable substitution in a template string using provided variables.
The template string containing ${variable} placeholders
Optionalvars: Record<string, unknown>Object containing variable values for substitution
The template string with variables substituted
Pure utility functions for internationalization (i18n) functionality. These functions handle translation loading, variable substitution, and namespace-based translation.