C15T Logo

Internationalization (i18n)

Learn how to add translations to your Consent Manager.

tocOn this page

[Error: Could not find section "overview" in ./shared/internationalization.mdx]

Implementation

You can pass the translations object in your ConsentManagerOptions object to configure the translations for your application.

import { configureConsentManager, type ConsentManagerOptions } from 'c15t';

const c15tConfig: ConsentManagerOptions = {
  // ... rest of your config
  translations: {
    defaultLanguage: 'en', // Optional: The default language to use if the browser's language is not supported.
    translations: {
      en: {
        common: {
          acceptAll: 'Accept all',
        },
        cookieBanner: {
          title: 'Cookie Banner',
          description: 'This is a cookie banner',
        },
      },
    },
  },
};

const c15t = configureConsentManager(c15tConfig);

[Error: Could not find section "types" in ./shared/internationalization.mdx]