PDb Polylang Adapter

Free

Adds full support for the Polylang plugin to Participants Database

Latest Release Available: Version 1.0.0

Description

This plugin is specifically for use with the Polylang multilingual plugin, which is used to make the site available in multiple languages.

The PDb Polylang Adapter adds functionality to Participants Database that supports the use of the Polylang plugin.

Instructions

When using Participants Database with the Polylang plugin, there are two ways that multilingual content is handled:

  • Language Pages
  • Multingual Strings

Language Pages

Polylang handles multilingual content by setting up a separate page for each language. This means that for each page on your site, there will actually be a set of pages, one for each language supported on the site. The Polylang plugin chooses which page to show the user based on the user’s chosen language.

When using Polylang and Participants Database, you will have have a separate plugin page for each language. This applies to the Participants Database “signup thanks” page, the “single record” page, the “participant record” page, and the “private link request” pages. For each of those special pages you are using, you will have one of those for each language you support.

For instance, in a trilingual site you will have 3 “thanks” pages: one in English, one in French and one in German.

Once the pages are set up, the Pdb Polylang Adapter plugin tells Participants Database which “thanks” page to use depending on the user’s chosen language.

How to Create Participants Database Language Pages

Start by creating the page in your default language. Let’s say you want to set up the signup page…Create a page for the signup form in your own language. Add the [pdb_signup] shortcode and whatever other content you want in your language.

Polylang has a feature that will duplicate the page to another language. So, to complete setting up the language pages, duplicate the page into each language you need. Then translate the content on each of those pages, leaving the [pdb_signup] shortcode the same on each one.

Using Participants Database Language Pages in Plugin Settings

When configuring Participants Database pages in the plugin settings, you only need to select one of your language pages in the setting. For example, to set up the “Signup Thanks Page” you only need to select one of the language versions of that page in the setting. It doesn’t matter which one.

The PDb Polylang Adapter makes sure that Participants Database selects the correct language page when providing a link to a special page: links to the record detail page or signup thanks page (for example) will point to the page in the current langage set by the user or the configured default language.

Multilingual strings

The Polylang plugin normally manages displaying text in multiple languages by using a system of registered strings where each display string is maintained by the Polylang plugin. The PDb Polylang Adapter add-on uses a different system for Participants Database: embedded multilingual strings. These strings are easy to maintain as they can be directly edited in the plugin settings.

Multilingual strings are created by tagging segments of text in the string, which defines the translated text for each language. The tags use square brackets to label each substring. For example:

[:en]Sign up here![:fr]Inscrivez-vous ici![:de]Hier anmelden![:it]Iscriviti qui![:]

When that string is displayed, it will show the sign up prompt in the user’s language.

To define a plugin configuration like the title of a database field, each of the supported languages is included in the name, which is then filtered to show only the title in the selected language:

Example of a multilingual field definition

The multilingual title setting for the first_name field is: [:en]First Name[:de]Vorname[:fr]Prénom[:it]Nome[:] which includes 4 different languages. You will notice in the screenshot above that multilingual strings can be used in other areas of the field configuration, so that things like the help text and validation messages will be shown in the user’s chosen language.

A multilingual string is a string that may contain one or several language-dependant substrings which are filtered to show only the currently selected (or default) language as set by Polylang. Its syntax is very close to the one used by the multilingual plugin QTranslate-X.

The PDb Polylang Adapter allows you to use multilingual strings for any setting or configuration in Participants Database.

Participants Database Add-Ons Supported

The PDb_Polylang Adapter is active throughout the Participants Database ecosystem, providing multilingual translation services for all Participants Database add-ons. Just use the same multilingual string format for any display string that can be configured in any of those plugins.

Language-Neutral Text

It’s possible to include untranslated strings within a multilingual string.

For example the multilingual string

[:fr]Maison à[:de]Haus in[:en]House in[:]Paris

will be displayed:

“Maison à Paris” when the current language is French
“Haus in Paris” when the current language is German
“House in Paris” when the current language is English.

How the Multilingual Filtering Works

Anytime the site is used, the user may choose which language to view the site in, or if the user has not chosen, there is a default language, so at all times there is a single language that is active. This is called the “locale” value. Multilingual strings are filtered according to the current locale, removing everything but the string designated for the current language.

If a string has no language tags, it will be displayed without any modification. Multilingual strings displayed in the backend of Participants Database for editing by the administrator are displayed unmodified, showing all the languages and language tags in the string.

Multilingual Field Options

When defining the options for a selector-type field (dropdowns, checkboxes, radio buttons, etc.) it’s possible to set up multilingual titles for the option values. For example an options setting of:

[:en]Yes[:fr]Oui[:]::1, [:en]No[:fr]Non[:]::0

Will show “Yes” or if the chosen language is French, “Oui” in the selector. When the value is saved, it will be saved as “1” so the same data is saved regardless of the user’s chosen language. If that same option is displayed in a different language, the title for that language will be shown, giving you the flexibility to change languages any time without invalidating stored data.

Reviews

There are no reviews yet.

Be the first to review “PDb Polylang Adapter”
You have to agree to the comment policy.

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.

No product-specific support has been configured for this product yet. Please contact me with your questions.