Hi @emindpo ,
hope you’re fine? I’m Edson from Weglot. By default, Weglot doesn’t translate PDF.
But we have a service who can help you to do it.
If the pdf from Gravity PDF is generate from an html you can use this service : wp-content/plugins/weglot/src/services/class-pdf-translate-service-weglot.php
You can see an example of use here : /wp-content/plugins/weglot/src/third/woocommercepdf/class-wcpdf-weglot.php
It’s an exemple we do to translate pdf invoice from woocommerce
Hope it’s help you
Regards
Thanks for chiming in @glx77!
@emindpo At this time Gravity PDF does not have support for Weglot (but it is on our future roadmap) and custom development would be required to get the results you’re looking for.
Looking at the code mentioned by @glx77, you will likely need to tap into the hook https://docs.gravitypdf.com/v6/developers/filters/gfpdf_pdf_html_output/ to access the HTML markup generated by Gravity PDF and then process it using code similar to this:
$pdf_translate_service = weglot_get_service( 'Pdf_Translate_Service_Weglot' );
$html = $pdf_translate_service->translate_pdf( $html, $language );
I didn’t see any code in Weglot that stores the language code with the Gravity Forms entry and I’m not familiar enough with Weglot to get the current active language code, which is what the variable $language
would represent. You’ll need to figure that part out.
Note: this is all untested and the information I’m providing is based purely off the code snippets referenced by @glx77.
Gentlemen, thank you for your responses. Will attempt your directives and come back to you with results.