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?
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.
- 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.
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.