Last updated
These docs are intended for a developer audience.Dismiss

Localize

This topic describes how to configure the Rebilly Instruments JS library to use different languages.

Set the default language

Use the locale property, in the RebillyInstruments.mount() function, to configure your default language. If this option is not passed, the language will default to the user's browser language.

Supported languages

  • English
  • Spanish
import RebillyInstruments from '@rebilly/instruments';

RebillyInstruments.mount({
  publishableKey: 'pk_sandbox_123',
  organizationId: 'org-123',
  websiteId: 'my-website-id',
  apiMode: 'sandbox',
  locale: 'auto',
});

Change text content

Change text content to a specific language by including it in the i18n property, of the RebillyInstruments.mount() function. This overrides the existing text with the language that is passed.

For a complete list of mount options, see RebillyInstruments.mount().

import RebillyInstruments from '@rebilly/instruments';

RebillyInstruments.mount({
  publishableKey: 'pk_sandbox_123',
  organizationId: 'org-123',
  websiteId: 'my-website-id',
  apiMode: 'sandbox',
  i18n: {
    en: {
      summary: {
        total: 'Your grand total'
      }
    }
  }
});

Add a new language

Add a new language by including it in the i18n property, of the RebillyInstruments.mount() function. Use a valid country ISO code to set the language ("en-ca" or "en").

import RebillyInstruments from '@rebilly/instruments';

RebillyInstruments.mount({
  publishableKey: 'pk_sandbox_123',
  organizationId: 'org-123',
  websiteId: 'my-website-id',
  apiMode: 'sandbox',
  i18n: {
    'en-ca': {
      summary: {
        total: 'Thank you, your Total is:'
      }
    }
  }
});