Passer au contenu Passer à la barre latérale

Ce sujet est résolu. Voici une description du problème et de la solution.

Problem:
You are using WP 6.7.1 with the Bellevue theme, Motopress Hotel Booking, and an official add-on to generate PDF invoices. You are trying to translate automatically generated invoices for bookings in additional languages (FR/NL), but some items are not being translated despite the terms being correctly translated on all website pages and in automatic generated admin e-mails.
Solution:
We suspect this might be a compatibility issue since the PDF add-on plugin is not mentioned in our internal systems. Here are the steps we recommend:
1. Confirm if the issue persists when you disable all plugins except Motopress and WPML.
2. If the issue continues, consider creating a sandbox environment to replicate the issue, or contact the Motopress team to inform them of the issue.
3. Modify the plugin code:

  • Backup your site.
  • Open
    .../wp-content/plugins/mphb-invoices/classes/pdf/pdf-helper.php
  • At line 248, replace:
    $booking = MPHB()->getBookingRepository()->findById($booking_id);

    with:

    $booking = MPHB()->getBookingRepository()->findById($booking_id);<br />// WPML Workaround for compsupp-7849<br />if (class_exists('Sitepress')) {<br />    $booking_language = $booking->getLanguage();<br />    do_action('wpml_switch_language', $booking_language);<br />}
  • At line 294, replace:
    return $render_variables;

    with:

    return $render_variables;<br />// WPML Workaround for compsupp-7849<br />if (class_exists('Sitepress')) {<br />    $default_lang = apply_filters('wpml_default_language', NULL);<br />    do_action('wpml_switch_language', $default_lang);<br />}

4. Some strings may also need to be translated in String Translation.
5. Create a French booking to see if the invoice is then in French.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, please open a new support ticket at WPML support forum.

Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.

Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.

Marqué : 

Ce sujet contient 14 réponses, a 0 voix.

Dernière mise à jour par davidD-150 Il y a 10 mois et 3 semaines.

Assisté par: Ilyes.

Auteur Messages
février 15, 2025 à 8:03 am #16708505

davidD-150

Once again many thanks for the providfed solution and the great support !