This tutorial shows you how to generate PDF documents in multiple languages using WooCommerce PDF Invoices & Packing Slips Professional and WPML.
Getting Started #
Start by installing and activating the following plugins:
- WooCommerce PDF Invoices & Packing Slips and WooCommerce PDF Invoices & Packing Slips Professional
- WPML core plugin and WPML String Translation add-on
- WooCommerce Multilingual (comes with your WPML CMS account)
WPML allows you to choose between two different translation modes:
- Translate Everything automatically translates your site’s content as you add or edit it. You can also choose to review the automatic translations to ensure they are correct.
- Translate Some allows you to decide which content to translate, as well as who will translate it. You can choose to translate your content yourself, send it to individual translators, or use a professional translation agency.
If you’re new to WPML, we suggest taking a look at their Getting Started Guide to learn more about the different translation options available.
Using WPML with WooCommerce PDF Invoices & Packing Slips Professional #
From your admin menu, go to WooCommerce > PDF Invoices and click on the Documents tab. If you click through the different documentoptions, you’ll see that some PDF settings now have language tabs.
This is shown in the example below for Documents: Invoice. As you can see, you can set the Document title and PDF filename for your default language, as well as your secondary language(s).
You can also set your Shop Name, Shop Address, and Footer in your default and secondary languages from the General tab. When you generate a PDF document, your customer will see these fields in the corresponding language.
For additional language settings, click over to the Pro tab and scroll down to Multilingual settings:
Use the drop-down list to define the language of your document(s). You can choose between three options:
- Order/customer language will generate a PDF in the language your customer places an order in.
- Site default language sets your site’s default language as the language of the PDF document.
- Specific language (choose from the available ones) generates your PDF in the language of your choice. You can choose between your site’s default language and secondary language(s).
Translating Strings in WPML #
WPML’s String Translation makes it possible to translate additional texts coming from your plugin:
- Go to WPML > Theme and plugins localization and scroll down to Strings in the plugins. Check the box next to WooCommerce PDF Invoices & Packing Slips Professional and click the Scan selected plugins for strings button.
- Once scanning is complete, go to WPML > String Translation and use the In domain drop-down menu to search for strings belonging to a certain domain. In our example, we are searching for strings in the
- A list of strings available for translation will appear. Click the plus icon under the language you want to translate your chosen string into. Input your translation and hit enter.
PDF Showing Strings in the Wrong Language #
- Go to WPML > String Translation and scroll down to Auto register strings for translation. Check the box to enable Look for strings while pages are rendered.
- Create a PDF document.
- Search for the custom strings in the String Translation table and enter the translations for each string.
The Auto register strings for translation feature automatically disables after two hours, but it may slow down your site. We suggest turning it off once you’ve found your strings.