WordPress - How to translate a PDF ?

In this article, you'll learn which kind of PDF can be translated by Weglot on your WordPress website


  1. Which PDF can be translated by Weglot?
  2. How can I add the code snippet?

1. Which PDF can be translated by Weglot?

Weglot can translate PDFs on WordPress using the following process:

When a plugin generates a PDF, by default it will not be translated. Thanks to a filter (a code snippet) Weglot will be able to retrieve the HTML code generated to create the PDF, in order to be able to translate the PDF.

Weglot is currently able to translate the following PDFs:

  • Gravity PDF:

Weglot provides a developer's documentation in which you'll be able to find the filter needed to activate the translation of Gravity PDF.

https://developers.weglot.com/wordpress/use-cases/translate-pdf-with-gravity-pdf

  • WooCommerce PDF invoice

Weglot provides a developer's documentation in which you'll be able to find the filter needed to activate the translation of invoice PDF generated by WooCommerce.

https://developers.weglot.com/wordpress/use-cases/translate-pdf-for-woocommerce-pdf-invoice

2. How can I add the code snippet?

There are two ways to add the code snippet:

  • You can either install a plugin, like Code Snippet, on your WordPress admin to add the code snippet more easily.
  • Alternatively, the code snippet can be added at the end of your functions.php file:

On your WordPress admin, to find your functions.php file, in the left sidebar, hover over Appearances, then click Theme Editor.

In the right sidebar, click on "functions.php". Here, you can add your code snippet at the bottom of this file.

Once the code snippet is added, don't hesitate to clear your WordPress cache to see the changes.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us