Language icon
An EN / BG switch for the components. Only for a site without its own language switcher.
- Box
data-pms-booking="language"- Goes on
- Your header
- Drawn
- On your page, in a shadow root
- Own HTML instead
- Yes — recommended
The ready component
One line to paste. It wears the property’s branding from the PMS until your site’s stylesheet says otherwise.
- Place the script once, on every page that shows a component — see Install the script.
- Paste the component where it should appear.
<div data-pms-booking="language"></div>Live preview on a sample hotel — invented rooms and prices, placeholder pictures. Open in a new tab
The live preview runs only when these docs are opened on a developer's own machine.
<div data-pms-booking="language"></div>Settings
This component has no settings.
A guest’s pick is remembered in their browser, and the page reloads in that language.
How it looks — colours, corners, fonts — is not an attribute. Your site’s stylesheet sets it with CSS variables: see Styling.
With your own HTML
Your site has its own language switch: leave this icon out. The components speak the page’s language and follow it when it changes, with no reload — with one exception, the frames, below.
The page’s own lang attribute
Without data-locale on the script the components read the lang of <html> and follow it when your site changes it.
<html lang="bg">| Attribute | Values | What it does |
|---|---|---|
data-locale | "en" | "bg" | The language of the components. Left out, they follow the page's own lang attribute, live. A guest's pick on our language icon wins over both. |
Or tell the script
Call this from your own switch. Every component on your page repaints in that language, with no reload, and room cards from a template are drawn again.
window.pmsBooking.setLocale('bg'); // or 'en'setLocale() and a change of <html lang> do the same thing; whichever happened last decides.
Our frames do not follow a live change. The details-and-payment step and the guest area open in the language the components speak at that moment, and a frame that is already open is not told of a later change — neither by setLocale() nor by <html lang>. refresh() does not change that. The details-and-payment step is opened anew each time the guest arrives at it; the guest area stays as it opened until the page loads again. So switch the language before the guest reaches a frame, or reload the page when the language changes on your booking or account page.
Your pages have an address per language
When a guest picks a language on our icon or menu, pms-booking-locale fires on window before the page reloads. Cancel it and take the guest to your own page for that language.
window.addEventListener('pms-booking-locale', (event) => { event.preventDefault(); // no reload: your site changes the page itself const path = location.pathname.replace(/^\/(en|bg)(?=\/|$)/, ''); location.assign(`/${event.detail.locale}${path}`);});Every attribute, method and variable: Attributes · JavaScript · Styling.