WPML
Status
Resolved by author
Related plugin/theme
Hotel Booking PDF Invoices

Overview of the issue

When using Motopress Hotel Booking with Hotel Booking PDF Invoice Addon, the generated invoice from your bookings cannot be translated to other languages.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open … /wp-content/plugins/mphb-invoices/classes/pdf/pdf-helper.php

  • Look for line 248
  • Replace
    $booking = MPHB()->getBookingRepository()->findById( $booking_id );

    with

    $booking = MPHB()->getBookingRepository()->findById( $booking_id );
    // WPML Workaround for compsupp-7849
    if ( class_exists('Sitepress') ) { 
    	$booking_language = $booking->getLanguage();
    	do_action( 'wpml_switch_language', $booking_language );
    } 

  • Then, look for line 294
  • Replace
    return $render_variables;

    with

    return $render_variables;
    // WPML Workaround for compsupp-7849
    if ( class_exists('Sitepress') ) { 
    	$default_lang = apply_filters('wpml_default_language', NULL ); 
    	do_action( 'wpml_switch_language', $default_lang );
    }
     
  • Note: Some of your invoices’ strings are to be translated from WPML > String Translation

All known issues →