• Resolved emindpo

    (@emindpo)


    Hi guys.

    We use WEGLOT for our translations into other languages. When a user selects a non-English language to complete the form and print the PDF, the entry results appear in English and not in their chosen language.

    Appreciate your assistance in resolving this matter.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    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.

    Thread Starter emindpo

    (@emindpo)

    Gentlemen, thank you for your responses. Will attempt your directives and come back to you with results.

    Hi @emindpo @blue-liquid-designs ,

    I hope it will help you, you can get the current language with this function : https://developers.weglot.com/wordpress/helpers-functions#weglot_get_current_language

    Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Weglot Translation Service’ is closed to new replies.