Sauter la navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 -
- - - - - - -

Fuseau horaire du supporter: Pacific/Easter (GMT-05:00)

Marqué : 

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

Dernière mise à jour par davidD-150 Il y a 11 heures et 45 minutes.

Assisté par: Ilyes.

Auteur Articles
janvier 29, 2025 à 3:44 pm #16647398

davidD-150

Contexte de la question:
I am using WP 6.7.1 with the Bellevue theme (Ver 4.2.6), Motopress Hotel Booking (Ver 5.0.4), and an official add-on to generate PDF invoices (Ver 1.4.2) on my site lien caché. I am trying to translate automatically generated invoices for bookings in additional languages (FR/NL).

Symptômes:
When generating invoices, some items are being translated and some aren't, despite the terms being correctly translated on all website pages and in automatic generated admin e-mails.

Questions:
Any idea on how to get all terms translated?

janvier 30, 2025 à 4:01 pm #16652761

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Hello,

Thank you for contacting WPML support team,

I highly suspect this to be a compatibility issue, Hotel Booking is indeed compatible: https://wpml.org/plugin/motopress/

But I do not see any mention of their PDF addon plugin on our internal systems.

Before escalating this to our compatibility team, I see that on Motopress release notes, the last time they updated the compatibility with WPML was from 2021 : lien caché

In here we have two things we could so :

1- Create a sandbox environment ( I can provide you with the link upon your next reply) and you replicate the issue there.
2- Contact Motopress team to let them know about this issue in hope they have a quick fix for it and to let them know that this issue exist (this helps us with our compatibility process)

But before this, could you confirm if the issue persist when disable all plugins except motopress and WPML plugin?

Best,

janvier 31, 2025 à 4:23 pm #16656680

davidD-150

Hello,

I tried to deactivate all plugins except MPHB and WPML, problem is still there ...
Best regards,

David

février 3, 2025 à 5:20 pm #16663930

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Hello,

In order to see if this issue is happening because of the configuration of your site, or just the combination of the hotel PDF addon plugin & WPML we need to isolate the issue.

I’ve created a sandbox here: lien caché

I’ve already configured WPML in 2 languages.

Please do the following:

- Open the Sandbox link mentioned above
- Download and activate the Motopress Hotel Booking plugins you are using.
- Create a test booking and translate it
- Does the PDF generated load the right language? Does the issue replicate?

Please note that we only need the theme/plugin and the related functionality, you don’t need to set up an entire website or clone your existing site.
https://wpml.org/faq/how-to-reproduce-issues-and-share-them-with-wpml-support/

Let me know when it is done.
Best regards,

février 3, 2025 à 7:19 pm #16664187

davidD-150

Hi Ilyes,

Many thanks for your feedback.
I have downloaded an archive (zip) of my purchased plugin from Evato Market on my computer, as it contains both Bellevue Theme and Motopress Hotel Booking in a bundle.
The problem is, I am not able to upload the bundled plugin(s) onto the Sandbox (error : The package could not be installed. No valid plugins were found. Plugin installation failed). See attached image.
Maybe there are some restrictions linked to my license (single website) ?
Do you see other options to reproduce the same issue ?

Best regards,

David

Screenshot plugin upload failed.png
février 4, 2025 à 5:07 pm #16668018

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Hello David,

We need to get these plugins installed on our sandboxes as we are going to change the code and break the plugin itself,

Could you share a link of the zip file? or upload it using File Manager on the sandbox?

You could also share an FTP access to your site, I could see if I can export the files of the plugin myself.

If that wasn't enough, then we need to contact the authors directly to provide a testing version, but I should be able to activate it from the zip file or FTP.

Best,

février 4, 2025 à 9:58 pm #16668573

davidD-150

Hi Ilyes,

I have installed and activated the Bellevue Theme with bundled plugins including MotoPress Hotel Booking.
I set up seasons, rates and made one accommodation active (room with sidebar booking).
In WPML two languages (EN + FR) have been configured and the associated terms 'translated' from EN to FR (with fr prefix).
I prepared two virtual bookings through the Admin dashboard.
When generating a PDF invoice, it always comes out in EN only - but to be honest I don't know how to set up bookings in different languages as I normally make those on the front end, simulating customers making their reservations on respective language pages.

Many thanks in advance,
Best regards,

David

février 7, 2025 à 4:28 pm #16680627

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Hello David,

It turns out the invoice is loading its content directly from the booking itself, and when I check with Motopress, I find this article : lien caché

That implies that the bookings are not to be translated, hence why the invoice cannot load the content in another language but English.

Even when forcing the booking translation as shown in here : lien caché

The booking translation is totally empty and the invoice is only able to load the english strings.

I have reported this to our compatibility team, they will see if motopress can make their PDF plugin compatible.

Best,

février 10, 2025 à 8:49 am #16685544

davidD-150

Hi Ilyes,

Great feedback, many thanks !
I am still having questions when I read in your last post that 'bookings are not to be translated' :
1. Admin emails that are automatically send to customers upon reservation are definitely translated (I suppose by WPML) in function of their respective languages ; See my previous ticket on the subject.
2. The PDF invoice plugin is translating some of the fields (mix of EN and FR), as was shown on the screenshot in my original ticket.

Why are some of the invoice fields translated, but not all of them ?
By analogy with Admin emails, isn't it a possibility to detect the language in which the reservation was made and to translate the invoice accordingly ?

Many thanks in advance,
Best regards,

David

février 10, 2025 à 12:53 pm #16687180

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Your analogy is right, but this PDF plugin is not taking that into consideration (not checking for the language), hence why it is not compatible.

For now, our compatibility team asked if you could make the frontend booking page to work so we can simulate the automatic generation of the invoice,

From the backend, we couldn't create a "french" booking as you described.

février 12, 2025 à 7:46 am #16694332

davidD-150

Hello Ilyes,

I tweaked the 'search availability' page to be functional both in EN & FR languages.
This page has been set as homepage in the sandbox.
I made already a reservation on the frontend in FRENCH (#272) as requested by the compatibility team.

Best regards,

David

février 13, 2025 à 12:38 am #16699607

Ilyes
Supporter

Les langues: Français (Français )

Fuseau horaire: Pacific/Easter (GMT-05:00)

Hello,

Thank you for helping with the booking installation,

We have found a possible fix for this issue and the invoice is now translated: lien caché

- Backup your site
- 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 that some strings need to be translated in String Translation too
- Then create a French booking > Invoice will be then in French

Let me know if that helped,

février 13, 2025 à 10:05 pm #16704629

davidD-150

Hi Ilyes,

Many thanks for this tutorial, I 'll let you know as soon as I can test it.
Any chance to have this code included in the MotoPress add-on so that it isn't erased with future updates ?

Best regards,

David