Using Weglot to generate multilingual PDF documents

Table of Contents

Setup #

Assuming one is already a Weglot Translate user: It is important to make sure the proper WeGlot language pair is selected, or else it should be added. Note that in the free version of WeGlot, only one target language can be used.

An image of Weglot settings
WeGlot settings – Language pair selection

Next, the WeGlot order language must be selected via our Invoicing plugin’s settings. These settings are located in the Pro tab:

An image of the Pro tab
WooCommerce > PDF Invoices > Pro

Once in the Pro tab, it is necessary to scroll down until there is a setting called Multilingual settings. Under this, there should be a table showing a list of Multilingual plugins with data about them.

An image of the multilingual settings
WooCommerce > PDF Invoices > Pro, then scroll to Multilingual settings

Finally, WeGlot order language should be selected as the value of the Document language setting. This setting is found below the Multilingual settings table.

An image of the document language setting
Select WeGlot order language, then Save Changes

Using the WeGlot dashboard is necessary to manage translations done using WeGlot. Once logged-into WeGlot, head to the Projects tab.

An image from the Weglot dashboard
1: Projects tab
2: Create project button

If you have not yet created a Project, select the Create Project button. After having created a new project, select the language pair you want to manage by clicking on it.

An image from the Weglot dashboard
Language pair management screen for a Project

It is important to know that once you have entered your WeGlot API key into your site, WeGlot will translate every navigated URL.

Clicking on a language pair will bring the website to a new screen, showing URLs on the left side of the page. These are the URLs that your WeGlot installation has translated.

An image from the Weglot dashboard
1: All translated URLs
2: Translation search

On the right side of the screen, two columns will show the translation results of the URLs. These URLs can be clicked in order to limit the translation results to only those of the clicked URL. Such a feature makes it easier to manage the PDF string translations, as they will all appear within the same translation results.

Below you will find:

  1. The correct URL to find translated PDF strings: “/”.
  2. An comment reading “Automatically translated string” . In this case, it is the “Order Date” translation. We will modify this string as a demonstration.
  3. A comment reading “Manually translated string”.
An image from the Weglot dashboard

From another browser tab, taking a look at a newly placed order’s Invoice PDF will reveal some familiar strings, validating that the Setup is working properly. For this article, the focus will be on changing the Order Date string, in order to demonstrate manually changing the PDF strings.

Order Date currently is translated to “Datum der Bestellung”.

An image of a PDF in German
Order Date string, to be modified – Order 129 Invoice

The translation is to be modified via the WeGlot dashboard. Click on a translation to modify it, then click on the checkmark that appears on the right to save it, as shown below.

The Order Date translation has been changed to “Bestellungsdatum” via WeGlot’s dashboard:

An image from the Weglot dashboardSaving a manually modified translation

An image from the Weglot dashboard
A manually modified translation

  • Note the selected URL, on the left side of the page.

Revisiting a refreshed version of the same PDF reveals the translation result.
The Order Date string was correctly modified, as “Datum der Bestellung” has been correctly updated to “Bestellungsdatum” on the PDF.

An image of a PDF in German
Translation result, manually modified, on refreshed PDF – Order 129

Troubleshooting #

  1. In order for WeGlot to translate strings, a new order must be placed, AFTER the WeGlot API key is entered into the WordPress website.

  2. The free version of WeGlot only allows for the translation of 2000 words! Beware, as this will require manually excluding URLs you do not wish to translate. This can be done at WeGlot > Translation Exclusion (Optional) > Exclusion URL.