Skip to main content

Internationalization

The SDK ships with built-in translation bundles for ThunderID UI components and provides utilities for loading, extending, and normalizing translations.

Supported Locales

LocaleLanguage
en-USEnglish (United States)
fr-FRFrench (France)
hi-INHindi (India)
ja-JPJapanese (Japan)
pt-BRPortuguese (Brazil)
pt-PTPortuguese (Portugal)
si-LKSinhala (Sri Lanka)
ta-INTamil (India)
te-INTelugu (India)

getDefaultI18nBundles()

Return all built-in translation bundles indexed by locale code.

import { getDefaultI18nBundles } from '@thunderid/javascript'

const bundles = getDefaultI18nBundles()
console.log(bundles['en-US']) // I18nBundle
console.log(bundles['fr-FR']) // I18nBundle

Returns: Record<string, I18nBundle>


normalizeTranslations(translations)

Flatten a potentially nested translation object into a flat key-value map. Nested keys are joined with ..

import { normalizeTranslations } from '@thunderid/javascript'

const flat = normalizeTranslations({
signin: {
title: 'Sign In',
button: 'Continue',
},
})
// { 'signin.title': 'Sign In', 'signin.button': 'Continue' }

Returns: Record<string, string>


TranslationBundleConstants

Constants for the default locale list and bundle configuration.

import { TranslationBundleConstants } from '@thunderid/javascript'

console.log(TranslationBundleConstants.DEFAULT_LOCALES)
// ['en-US', 'fr-FR', 'hi-IN', 'ja-JP', 'pt-BR', 'pt-PT', 'si-LK', 'ta-IN', 'te-IN']

Types

I18nBundle

A translation bundle for a single locale.

PropertyTypeDescription
localestringBCP 47 locale code (e.g., 'en-US')
translationsI18nTranslationsKey-value translation map

I18nTranslations

type I18nTranslations = Record<string, string>

Keys follow dot-notation (e.g., 'signin.title', 'user.profile.update.generic.error'). Values are the translated strings, which may include {{placeholder}} interpolation tokens.

TranslationFn

A function type used to resolve a translation key to its string value in custom integrations:

type TranslationFn = (key: string, values?: Record<string, string>) => string

Providing Custom Translations

Custom translations can be passed via the preferences.i18n.bundles configuration option:

await client.initialize({
clientId: '<your-client-id>',
baseUrl: 'https://localhost:8090',
preferences: {
i18n: {
language: 'en-US',
bundles: {
'en-US': {
'signin.title': 'Welcome Back',
'signin.button': 'Log In',
},
'de-DE': {
'signin.title': 'Willkommen zurück',
'signin.button': 'Anmelden',
},
},
},
},
})

Custom keys are merged on top of the built-in bundle — you only need to supply the keys you want to override.

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy