Using TranslatePress to generate multilingual PDF documents

Basic setup #

Required #

Document language setting #

Once TranslatePress is installed and has been activated, it will be indicated in our plugin’s settings at WooCommerce > PDF Invoices > Pro.

An image showing multilingual settings

Next, navigate to WooCommerce > PDF Invoices > Pro, then scroll down to Document language.
Document language should be set to Order/customer language, unless you are trying to force the PDF to a specific language.

An image of settings

Multilingual settings #

The languages set in TranslatePress will determine the multilingual tabs in the settings. From the TranslatePress settings below, the available languages are:

  • English
  • Spanish
An image showing multiple-language options in TranslatePress

This will set which language columns appear for compatible settings, making them multilingual, as shown below.

An image of multilingual settings
  • Path: WooCommerce > PDF Invoices > General
An image of settings

Since this adds the ability to set a different shop logo per language (language locale), it becomes possible to add the same shop logo – with different text, to truly reach a multilingual shop feeling.

Examples #

The images below represent an example of multilingual-friendly logos:

An image of settings
An image of settings
  • Example – Logo set for Spanish:
An image of settings
  • Example – Logo set for German:
An image of settings

Shop Name #

  • Path: WooCommerce > PDF Invoices > General

Shop Name setting in French:

An image of settings
An image of settings

Shop Name setting in German:

An image of settings
An image of settings

Shop Address #

  • Path: WooCommerce > PDF Invoices > General
An image of settings
  • Path: WooCommerce > PDF Invoices > General
An image of settings

Extra template fields #

An image of settings

Document title #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to Document title.
An image of settings

PDF filename #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to PDF filename.
An image of settings

Document number label #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to Document number label.
An image of settings

Document date label #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to Document date label.
An image of settings

Due date label #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to Due date label.
An image of settings

VAT number label #

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to VAT number label.

For the VAT number label of the Shop.

An image of settings

COC number label #

For the Spanish Chamber of Commerce.

  • Path: WooCommerce > PDF Invoices > Documents, select the document type then scroll to COC number label.
An image of settings

Address customization #

Enjoy different address structures based on your document language.

An image of settings

The fields to overwrite the Billing Address:

An image of settings

Similar to above, the fields to overwrite the Shipping Address:

An image of settings

Set order language manually #

Path: WooCommerce > Orders, then select an order or create a new order. Then scroll down to the ‘Custom Fields‘ section.

You will need to do so by creating the wcpdf_trp_language custom field and adding the language code as its value (like ‘en-US‘). Users will now receive their documents in this language, if the Document language setting is set to ‘Order/Customer language‘.

An image of settings

This could be done at the time of order, but it also could be done afterwards. Modifying the custom field value will just change the TranslatePress order language of the order.

Not to be confused with the trp_language custom field, which would help you remember the original language of the order. It will not set the document language however.

String Translation #

Please use Loco Translate to modify the individual strings to your liking. Strings in this context are what we think of as words that can be translated.