Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: ,

This topic contains 40 replies, has 2 voices.

Last updated by Shekhar Bhandari 4 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
December 27, 2023 at 4:02 pm #15132710

andrzejG-9

Thank you for your answer!
We getting into the panic mode here.

Please keep me posted.

December 29, 2023 at 1:08 pm #15136746

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello,

Just to update you, we have identified the issue and in-order to fix this we will need our developers help, we have forwarded the issue to our developers and as soon as I will have further feedback about it, I will update you here.

Thanks

December 29, 2023 at 1:32 pm #15136787

andrzejG-9

Thank you for the update!

January 2, 2024 at 7:52 am #15140326

andrzejG-9

Good morning and all the best in new year!
Do we have any update on the issue?

Thanks
Andre

January 3, 2024 at 12:59 pm #15146638

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello,

Happy New Year 🙂

Our developer team is actively working on this issue and trying to find a solution for your site.

I will update you as soon as I will have any feedback.

Thanks

January 4, 2024 at 1:38 pm #15150772

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Our 2nd tier supporters suggested the following workaround:

- Edit the file wp-content\plugins\sitepress-multilingual-cms\classes\ATE\API\class-wpml-tm-ate-api.php Line number 357 replace

		public function get_languages_supported_by_automatic_translations( $languageCodes, $sourceLanguage = null ) {
			$sourceLanguage = $sourceLanguage ?: Languages::getDefaultCode();

			$result = $this->requestWithLog(
				$this->endpoints->getLanguagesCheckPairs(),
				[
					'method' => 'POST',
					'body'   => [
						[
							'source_language'  => $sourceLanguage,
							'target_languages' => $languageCodes,
						]
					]
				]
			);

			return Maybe::of( $result )
			            ->reject( 'is_wp_error' )
			            ->map( Obj::prop( 'results' ) )
			            ->map( Lst::find( Relation::propEq( 'source_language', strtolower($sourceLanguage) ) ) )
			            ->map( Obj::prop( 'target_languages' ) );
		}

with

		public function get_languages_supported_by_automatic_translations( $languageCodes, $sourceLanguage = null ) {
			$sourceLanguage = $sourceLanguage ?: Languages::getDefaultCode();

			$lang_case_mapping = [
				'de_at' => 'de_AT',
				'de_ch' => 'de_CH',
				'de_li' => 'de_LI'
			];
			$languageCodes = array_map(function($code) use ($lang_case_mapping){
				return isset($lang_case_mapping[$code]) ? $lang_case_mapping[$code] : $code; 
			}, $languageCodes);

			$result = $this->requestWithLog(
				$this->endpoints->getLanguagesCheckPairs(),
				[
					'method' => 'POST',
					'body'   => [
						[
							'source_language'  => $sourceLanguage,
							'target_languages' => $languageCodes,
						]
					]
				]
			);

			$revert_lang_code = function($obj) use ($lang_case_mapping) {
				$lang_case_mapping = array_flip($lang_case_mapping);
				foreach ($obj as $key => $value) {
					if (isset($lang_case_mapping[$key])) {
						$obj->{$lang_case_mapping[$key]} = $value;
						unset($obj->$key);
					}
				}

				return $obj;
			};

			return Maybe::of( $result )
			            ->reject( 'is_wp_error' )
			            ->map( Obj::prop( 'results' ) )
			            ->map( Lst::find( Relation::propEq( 'source_language', $sourceLanguage ) ) )
			            ->map( Obj::prop( 'target_languages' ) )
			            ->map( $revert_lang_code );
		}

I already made the changes to your site and it's working properly, so can you please check? I made it in the dev instance.

Look forward to your reply.

Thanks

January 4, 2024 at 2:45 pm #15151897

andrzejG-9

Thanks for the workaround. I truly appreciate it.
Will be waiting for permanent solution update.

Thank you.

January 5, 2024 at 6:01 am #15153224

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Sure, I am setting the status of the ticket to escalated to the developers team, will update you when the permanent fix will be released.

May 6, 2024 at 6:29 am #15595122

andrzejG-9

So when I will be able to update my code to remove this ugly workaround?

Thanks

May 6, 2024 at 9:11 am #15596152

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I will update you as soon as the fix is released, right not the issue is still in our developers queue.

Thanks

May 15, 2025 at 4:24 am #17034819

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello,

I am writing to inform you that the issue has been resolved in the latest versions of the plugins.

Thank you for your attention to this matter.