Using WP Booking System with TranslatePress
WP Booking System works a little differently with TranslatePress than it does with translation plugins such as WPML or Polylang.
This is because TranslatePress handles translated pages differently.
How TranslatePress works
Plugins such as WPML and Polylang usually create a separate version of a page for each language.
This means that you can place the WP Booking System shortcode on each translated page and specify the appropriate calendar language.
For example:
[wpbs id="1" language="fr"]
On the Spanish version of the page you could use:
[wpbs id="1" language="es"]
You can also normally use the auto language option when working with plugins that create separate translated pages.
TranslatePress does not work this way.
Instead, TranslatePress uses the same WordPress page for all languages and replaces the translated content dynamically. You are essentially translating the content and strings displayed on the page rather than creating separate pages.
Because of this, WP Booking System cannot automatically determine which calendar shortcode should be displayed simply based on the page being viewed.
Displaying the correct calendar language
TranslatePress provides conditional shortcodes that allow you to display content only when a specific language is active.
You can use these shortcodes around the WP Booking System shortcode to load the calendar with the appropriate language.
For example, if your website is available in French and Spanish:
[language-include lang="fr_FR"]
[wpbs id="1" language="fr"]
[/language-include]
[language-include lang="es_ES"]
[wpbs id="1" language="es"]
[/language-include]
When the visitor views the French version of the website, WP Booking System will display the calendar using French.
When the visitor switches to Spanish, the Spanish version of the calendar will be displayed instead.