• Resolved gaspar

    (@gaspar)


    I use mQtranslate and “glue” language plugins for Woocommerce.
    Your plugin respects selected language both in front and backend.
    But not in PDF creation. If i change language in web page then AJAX request (URL does not contain ?lang=mynewlang) fails – i displays language before change.

    How can i change this AJAX request behaviour? Should i manually / programmatically add this missing language parameter? Or what variable i should change after language change so AJAX request gets the right value?

    https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Gaspar,
    Unfortunately I cannot give support for mQtranslate.
    If adding &lang=mynewlang to the url does not work then I’m afraid there’s not much I can do to help. You could try to change the urls in the plugin code in includes/class-wcpdf-writepanels.php. The urls for the order listing buttons are in the add_listing_actions function (line 86 and onwards).

    However, this is not update proof and multilingual wordpress is quite complex. It will probably also not select the right language for emails (which is an internal process rather than a web call).

    Note that we do support multilingual WordPress through WPML, if you use our Professional extension.

    Kind regards,

    Thread Starter gaspar

    (@gaspar)

    What variable your plugin uses to detect which language file to include?

    Plugin Contributor Ewout

    (@pomegranate)

    My plugin doesn’t use any variable: it just points WordPress to the location where all language files are stored, the rest is handled by WordPress, following your settings (or WPML if you’re using that).

    Thread Starter gaspar

    (@gaspar)

    Thanks. I’ve contacted to translation plugin developers to fix it.

    Thread Starter gaspar

    (@gaspar)

    One suggestion. Can you please add filter option for links (so other plugins can use them to add required parameters)? So we do not have to modify the core..

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Gaspar,
    You can already do that, using the wpo_wcpdf_listing_actions filter!

    for example:

    add_filter( 'wpo_wcpdf_listing_actions', 'wpo_wcpdf_listing_actions', 10, 2 );
    function wpo_wcpdf_listing_actions( $listing_actions, $order ) {
    	$lang = 'mynewlang';
    	$listing_actions['invoice']['url'] = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id . '&lang='. $lang ), 'generate_wpo_wcpdf' ),
    	return $listing_actions;
    }

    Thread Starter gaspar

    (@gaspar)

    Well, thank you!
    Excellent support ??

    Thread Starter gaspar

    (@gaspar)

    This filter ‘wpo_wcpdf_listing_actions’ is not valid for Account page.
    It works in admin.

    Thread Starter gaspar

    (@gaspar)

    I used ‘wpo_wcpdf_myaccount_actions’ filter for that and it works.

    Have a good day!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PDF generation not respectin current language’ is closed to new replies.