Optional configuration for i18n initialization
Configuration options for initializing the i18n service.
OptionalcurrentLanguage?: stringThe current/preferred language code (e.g., 'en-US', 'es-ES')
OptionalfallbackLanguage?: stringThe fallback language code if current language fails to load
Promise resolving to a fully configured i18n service interface
// Basic initialization
const i18nService = await createI18nService();
// With custom language
const i18nService = await createI18nService({
currentLanguage: 'es-ES',
fallbackLanguage: 'en-US'
});
// Use translations with safe HTML rendering
const t = i18nService.translator('mfa');
const message = t('enrollment.success'); // Plain text
const elements = t.trans('help.link', {
components: {
link: (children) => <a href="/help">{children}</a>
}
}); // Safe HTML components
Creates an internationalization (i18n) service with translation loading and management capabilities.
This factory function initializes the i18n service with language support, translation loading, and runtime language switching. It supports namespace-based translations, variable substitution, and safe HTML rendering through Trans component pattern.