Skip to main content

Localization

You can localize labels in the interface of JavaScript Booking and present it in any necessary language. You just need to provide localized strings for labels and apply your locale to the component.

Default locale

The English locale is used by default:

const en = {
lang: "en",
booking: {
...
}
};
info

Besides the en locale, Booking also includes the built-in ru and cn locales

ru locale
const ru = {
lang: "ru",
booking: {
...
}
};
cn locale
const cn = {
lang: "cn",
booking: {
...
}
};

Custom locale

To apply a custom locale you need to:

  • create the custom locale (or modify the existed one) and provide translations for all text labels in Booking (it can be any language you need)
  • apply the new locale via the locale property or by calling the setLocale() method, that takes an object with translations (custom locale) as a parameter

Example

In this snippet you can see how to switch through the EN, RU and CN locales:

[TODO]!!! Заменить ссылку на сниппет с локализацией