// Add this using plugin "Code Snippet"// create a new meta entry to store the weglot_language for the Gravity form entriesfunctionget_entry_meta( $entry_meta, $form_id ) { $entry_meta['weglot_language'] =array('label'=>'Weglot language','is_numeric'=>false,'is_default_column'=>true,'update_entry_meta_callback'=>array( $this,'update_entry_meta' ), );return $entry_meta;}functionupdate_entry_meta( $key, $lead, $form ) {return""; // return the value of the entry meta}//use the gform_after_submission hook to store the weglot languageadd_action('gform_after_submission','after_submission');functionafter_submission( $entry ) { $request_url_services =weglot_get_service('Request_Url_Service_Weglot'); $current_language = $request_url_services->get_current_language()->getExternalCode();gform_update_meta( $entry['id'],'weglot_language', $current_language );}// get the meta entries to translate the pdfadd_filter('gfpdf_pdf_html_output',function( $html, $form, $entry, $settings, $Helper_PDF ) { $qp =newGFPDF\Helper\Helper_QueryPath(); $wrapper = $qp->html5( $html ); $pdf_translate_service = weglot_get_service('Pdf_Translate_Service_Weglot'); $weglot_language = gform_get_meta( $entry['id'],'weglot_language'); $html = $pdf_translate_service->translate_pdf( $html, $weglot_language ); $wrapper = $qp->html5( $html['content'] );return $wrapper->top('html')->innerHTML5();},10,5);