Contents
Multilingual - Plugixa Car Parking
This page describes exactly what version 1.0.0 does on a multilingual site. The short version: the plugin’s interface text is translatable and it ships a WPML configuration file for its settings texts, but it does not keep separate translations of your locations, space types, forms or coupons.
What the plugin does
Its interface text is translatable
Every string uses the plugixa-car-parking text domain, and a template ships in
languages/plugixa-car-parking.pot. That covers:
- the booking form, the booking summary, the payment return screen and the customer account page;
- the messages a customer can see, such as “No booking matches that reference and email.”;
- the invoice;
- the whole admin app. Its strings are translated on the server and handed to the app, so a single translation of the text domain covers the admin too.
A string with no translation shows in English.
To translate the plugin, create plugixa-car-parking-<locale>.po and .mo
files from the template with a tool such as Poedit or Loco Translate, and place
them in wp-content/languages/plugins/.
The public pages follow the visitor’s language
The public pages are rendered in the language WordPress has chosen for the request. On a WPML or Polylang site that is the language of the page being viewed, so a booking form on a French page shows the plugin’s French translation, if one is installed.
The date picker in the booking form follows the same language. Translations for it ship inside the plugin. When there is none for a language, the calendar stays in English.
It ships a WPML configuration file
The plugin’s wpml-config.xml tells WPML, and plugins that read the same file
such as Polylang, about two things.
Settings texts. These values of the plugixacarparking_settings option are
registered as translatable admin texts:
| Setting | Where it is edited |
|---|---|
offline_instructions |
Settings -> Payments -> Instructions for the customer |
customer_confirm_subject, customer_confirm_message |
Settings -> Notifications -> Booking received |
admin_notify_subject, admin_notify_message |
Settings -> Notifications -> New booking notice |
With WPML they appear under WPML -> String Translation once the settings have been saved. The Payment received email is not in the file.
The shortcode. The [plugixa_car_parking] shortcode is registered with the
attributes id, form, location, view and mode, so they can be adjusted
when a page is translated. See
Shortcodes for which of them
do something in version 1.0.0.
Right-to-left languages
The public pages are laid out with logical directions and follow the direction of the page, so they work in Arabic, Hebrew and other right-to-left languages without a separate stylesheet.
What the plugin does not do
- It does not translate your records. A location has one name and one description. So does a space type, an extra, a coupon and a booking form’s custom field. They are shown as you typed them, in every language.
- It does not detect WPML or Polylang. No code in version 1.0.0 checks for either plugin. The configuration file above is the whole integration.
- It does not record the language of a booking. The bookings, locations and
space types tables each have a
language_codecolumn, but version 1.0.0 neither fills it nor reads it. - It sends emails in one wording. The email templates in Settings are one text each. Translating them through WPML’s string translation is the only way to vary them by language.
- It uses one currency. See Settings.
Running the form in several languages
The pattern that works with what version 1.0.0 offers:
- Install a translation of the
plugixa-car-parkingtext domain for each language. - Create the booking page in each language with your multilingual plugin, and place the same shortcode on each. The form’s own text follows the page.
- For text you wrote yourself, choose wording that works in every language, or
create one location or one
booking form per
language and place each on the matching page. A form can be limited to some
locations, and the shortcode’s
formattribute picks the form. - Do the same for the page that holds
[plugixa_car_parking_account].
The Booking page and Booking summary page settings each hold one page. Emails link to that one summary page, whatever language the customer booked in.
For developers
The labels a public page shows for booking and payment statuses pass through
the plugixa_carparking_status_labels filter, and the admin app’s strings
through plugixa_carparking_admin_i18n_strings. See
Hooks reference.