Using Polylang to generate multilingual PDF documents


Setup #

Requirements:

Note: While Polylang by itself allows for PDF translations, managing multilingual content efficiently is difficult without the Polylang WooCommerce addon. This documentation focuses on the basics of our Polylang compatibility.

At WooCommerce > PDF Invoices > General > Multilingual, unless you need to set the language to a specific one, set the Document language to Order/customer language.

With Polylang configured, users will receive their documents in the language in which Polylang set their Checkout at the time of purchase,

Polylang also enhances certain settings of our Invoicing plugin by adding multi-lingual tabs to them. These language tabs are set via the Polylang ‘Languages’ menu.

An image of Polylang settings

The following list shows how the multilingual tabs appear for compatible settings.

Multilingual settings #

All document settings are saved in the WooCommerce order meta. These multilingual settings keep existing even if Polylang is uninstalled.

See Settings compatible with multilingual plugins for a full list.

String translation #

It is recommended to use Loco Translate to assist with this purpose, as Polylang will only detect strings that are manually entered into the site. Loco Translate will help with the strings that are hard-coded into the plugin files.

Custom Block translation #

The content from Custom Blocks is not translated by default, as they are inserted manually (by the user).


The document language below is in French, so we expect our manually added text to be in French, not in English.


In order to translate these strings, they need to be searched via the Polylang settings at Languages > Translations.

Once in Polylang’s ‘Translations‘ settings:
– Change the current language to the language in which you want to edit the translation.
– Search for the string (text) you would like to translate.

In our example, our target language is French.

When viewing the search results, the Group should always be PDF Invoices & Packing Slips for WooCommerce – Premium Templates if it is from a Custom Block. This Group column will always give a hint regarding where the inserted string came from.

From here, the desired text can now be inserted. Remember to save your translation.

Here is the result on a document:

Set order language manually #

Either one of these paid plugins provides access to language selection:

  • Polylang for WooCommerce
  • Polylang Pro

These listed plugins add the ability to set the order language with a click of a button, from the WooCommerce order details screen (WooCommerce > Orders, then select an order). The feature will be located in the Language section.



Troubleshooting #

  • When viewing search results from the Polylang translation settings at Languages > Translations, it is important to take note of both the Name and Group of the result.

  • Remember to leave the Document language setting at ‘Order/customer language’ to avoid sending all your customers documents in the same forced language.

An image showing the Document Language setting
WooCommerce > PDF Invoices > Pro