Navigation überspringen

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Unterstützt die Zeitzone: Europe/Zagreb (GMT+02:00)

Schlagwörter: 

Dieses Thema enthält 30 Antworten, hat 0 Stimmen.

Zuletzt aktualisiert von Bruno Kos Vor 5 Tage, 19 Stunden.

Assistiert von: Bruno Kos.

Verfasser Beiträge
März 4, 2025 at 12:25 pm #16773682

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Can you please try the following:

1. Open `\wp-content\plugins\tourmaster\include\utility.php`.
2. Look for line **270** and uncomment the code by removing `//`.
3. On line **277**, replace:

 $post_info = apply_filters('wpml_post_language_details', NULL, get_the_ID());

with:

   $post_info = apply_filters('wpml_post_language_details', NULL, $post_id);

Does it translate the email now?

März 4, 2025 at 8:42 pm #16775923

remigiusK

Hi Bruno, you want me to change in the live page. In that case I have different line numbers (see attachment). Or do you want me to change it at the sandbox page?

Screenshot 2025-03-04 214154.png
März 5, 2025 at 9:26 am #16777457

remigiusK

The attachment is for your information (answer support from Goodlayers)

1000148260.jpg
März 5, 2025 at 10:06 am #16777677

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Try this on your live site. Do you have the same Tour Master version? In Sandbox we don't have FTP access so any coding mistake would take the site down.

Lines should not matter for as long as you commented and changed the same function.

270.png
März 5, 2025 at 5:49 pm #16780203

remigiusK

Thanks Bruno. I will try it out. However I can't see what I should do with line 270 or in the equivalent line in my file. There is no \\ for removing. Could you guide me here please?

März 6, 2025 at 12:53 pm #16783345

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Let me check and confirm with our compatibility team, I will get back to you.

März 6, 2025 at 2:03 pm #16783876

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

The whole function should be like this, so everything should be uncommented. I apologize for the confusion.

	if( !function_exists('tourmaster_set_locale') ){
		function tourmaster_set_locale($post_id){
			 global $sitepress;
			 
			 if( function_exists('pll_get_post_language') ){
			 	$new_locale = pll_get_post_language($post_id, 'locale');
			 }else if( !empty($sitepress) ){
			 	$post_info = apply_filters('wpml_post_language_details', NULL, $post_id);
			 	if( !empty($post_info['locale']) ){
			 		$new_locale = $post_info['locale'];
			 	}
			 }
			 
			 if( !empty($new_locale) ){
			 	switch_to_locale($new_locale);
			 	unset($GLOBALS['tourmaster_general']);
			 }

		}
	}
	if( !function_exists('tourmaster_return_locale') ){
		function tourmaster_return_locale(){	
			 global $sitepress;
			 	
			 if( function_exists('pll_get_post_language') || !empty($sitepress) ){
			 	restore_previous_locale();
			 	unset($GLOBALS['tourmaster_general']);
			 }
		}
	}
März 7, 2025 at 8:49 pm #16790020

remigiusK

Hi Bruno, I tested it with my live page and it works from what I have seen so far. Let me further test it (other languages) but it looks promising. Thank you and kind regards, Remy

März 8, 2025 at 7:40 pm #16791872

remigiusK

Hello Bruno, in addition to my previous comment this is what Goodlayers replied (see attachment). Thanks and regards, Remy

Screenshot 2025-03-08 203858.png
März 10, 2025 at 9:40 am #16795307

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Let me check and confirm with our compatibility team, I will get back to you.

März 10, 2025 at 6:54 pm #16798170

remigiusK

Hi Bruno, in the meantime I have tested it further and I noticed the following.
- It is only working partly
- A booking which I made with an English language set browser and English translated tour works
- A booking which I made with a German browser but using the English translated tour does not work, i.e. the email still comes in German language.
Kind regards, Remy

März 11, 2025 at 6:46 am #16799497

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Does the "partly" refer to these two examples or if some strings are not appearing as translated in the English email?

If the second scenario, can you send me a screenshot?

März 11, 2025 at 9:41 pm #16804238

remigiusK

Hi Bruno,

It means that your solution works only with first of the following two scenarios:

E-Mail with invoice is sent in the correct language:
A booking which was made with an English language set browser and English translated tour, e.g. versteckter Link, works fine

E-Mail with invoice is sent in the incorrect language (default language of the WP site):
A booking which was made with a German language set browser and using the English translated tour, e.g. versteckter Link, does not work

Maybe its the issue is what Goodlayers mentioned.

Thank you and regards, Remy

März 12, 2025 at 6:36 am #16805051

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Thank for the details. We are checking this further and will keep you posted!

März 13, 2025 at 6:05 am #16809783

Bruno Kos
Unterstützer

Sprachen: Englisch (English ) Deutsch (Deutsch ) Französisch (Français )

Zeitzone: Europe/Zagreb (GMT+02:00)

Let's try another solution:

1. **Undo the first workaround.**
Comment back the code inside

tourmaster_set_locale

and

tourmaster_return_locale

.

2. **Modify the filter priority.**
In

utility.php

, line 36, they are using the

wpml_user_language

filter. Increase its priority to 20 by updating the code as follows:

add_filter('wpml_user_language', 'tourmaster_get_email_locale', 20, 2);

3. **Ensure that key pages are translated.**
Make sure that pages related to this plugin—Register, Login, and Payment—are translated. Otherwise, users may be redirected to the German version during the reservation process.

### Our test:

- On **Firefox**, we changed the browser language to German.
- We booked the English tour at

/en/tour/africa-amazing-african-safari/

.
- During the booking process, we ensured that the language remained in English (e.g.,

/en/?tourmaster-payment

).
- On **Chrome**, logged in as an admin with a German profile:
- We went to **Tour > Orders** and approved the tour.
- We checked the email logs, and the email was sent in English.

Please test on your end and let us know if the issue is resolved.