Internationalization
Translate consent UI into 30+ languages with built-in translations, custom overrides, and automatic browser language detection.
c15t ships with built-in translations for 30+ languages via the @c15t/translations package. Language detection happens automatically based on the browser's language preference, and you can override or extend translations for any language.
There are two ways c15t can load translations: client-side or server-side.
| Server-side | Client-side |
|---|---|
| The best way to reduce bundle size and improve performance. We can detect the user's language based on the browser's language settings, allowing for the most accurate translations. By default, when using a consent.io hosted instance, these languages are supported. | Bundled with the application allowing for multiple languages to be supported without the need for a backend. The more translations you have, the larger the bundle size will be, which may impact the performance of your application. |
Basic Configuration
Pass custom translations via the translations option:
Custom translations are deep-merged with built-in defaults - you only need to override the keys you want to change.
Translation Package Imports
Use the import path that matches your use case:
@c15t/translations: types, utilities, andenTranslationsonly (smallest client bundle)@c15t/translations/en: English-only translation object@c15t/translations/all: fullbaseTranslationsmap for all bundled locales
If you bundle translations client-side and need multiple languages, import from @c15t/translations/all explicitly:
Translation Sections
The Translations object is organized into sections:
| Section | Controls |
|---|---|
common | Shared button labels: acceptAll, rejectAll, customize, save |
cookieBanner | Banner title and description |
consentManagerDialog | Dialog title and description |
consentTypes | Per-category title and description (keyed by AllConsentNames) |
frame | Frame placeholder title and button text (supports {category} placeholder) |
legalLinks | Privacy policy, cookie policy, terms of service link text |
iab | IAB TCF banner, preference center, vendor list translations |
Reading Translations
Use the useTranslations() hook to access the current language's translations:
Changing Language
Switch the active language at runtime with setLanguage():
setLanguage() re-fetches the consent banner to get server-resolved translations for the new language.
Automatic Language Detection
By default, c15t detects the browser's language (navigator.language) and selects the closest matching translation. If no match is found, it falls back to defaultLanguage (or 'en').
Disable auto-detection to always use defaultLanguage:
Custom Consent Type Labels
Override the title and description for individual consent categories: