Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is using the dynamic text feature to customize the single post hero, but the author description is always shown in English, despite the content being available in other languages. The issues identified are: (1) The default description is automatically assigned the "English" language, even if it was originally in Italian. (2) Translated text strings are not used, and the English version is always shown.
Solution:
First, we recommended changing the source language of the strings to Italian and then translating them. For guidance, we provided a link to our documentation: https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/
Next, we identified an issue with GenerateBlocks and GP Premium Elements affecting the dynamic display conditions. We provided a code snippet to fix the issue:https://wpml.org/forums/topic/a-dynamic-text-in-generatepress-is-not-getting-translated-even-if-all-translated/#post-15670522

We are also considering reaching out to the author of GeneratePress to implement this change in "GP Premium".

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 further assistance is needed, please open a new support ticket at WPML support forum.

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 8 replies, has 2 voices.

Last updated by Andreas W. 1 year ago.

Assisted by: Andreas W..

Author Posts
May 23, 2024 at 3:36 pm #15664259

Thomas

Tell us what you are trying to do?
I am using the dynamic text feature to get a customized single post hero working. Everything is fine, but the Author description is always shown in English, even if the content is available in other languages.
Is there any documentation that you are following?
Yes, I followed your documentation to enable the translation of Author meta data; I think there are actually two issues:
(1) The minor issue is that the default, existing description is automatically assigned the "English" language, even if it was Italian in my case (Italian is the default language of the installation).
(2) The translated text strings are not used thereafter, e. g. the english version is always shown in the author description, e. g. see:
hidden link
hidden link
hidden link
(author section on the top right side)
Is there a similar example that we can see?
See the above
What is the link to your site?
hidden link
hidden link
hidden link

May 23, 2024 at 7:08 pm #15664965

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

In this case, you would need to change the source language of the strings to Italian and then translate them.

Guide:
https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/

Please give this a try and let me know if you need further assistance.

Best regards
Andreas

May 23, 2024 at 8:06 pm #15665123

Thomas

That solved the minor issue, but issue (2) persists (even after clearing all caches etc.).

Now the Italian version is shown on all pages, no matter the language.

May 23, 2024 at 8:33 pm #15665174

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

You did try to translate the string again?

Please provide me with details about how and where you are implementing those dynamic strings.

I would like to offer to have a closer look at the problem and request temporary access (wp-admin and FTP) to the website to investigate this issue further.

You can find the required fields below the comment section when you log in to leave the next reply. The information you provide is private, which means only you and I can see and access it.

IMPORTANT
Please be sure to make a backup copy of the website and database before allowing us access.
If you can't see the wp-admin / FTP fields, your post and website credentials are set as PUBLIC. DO NOT publish the data unless you see the required wp-admin / FTP fields.

The private response form looks like this:
hidden link

Next time you reply, click "I still need assistance."

Video:
hidden link

Please note that we are obliged to request this information individually on each ticket. We may not access any access information not specifically submitted on this ticket in the private response form.

Best regards
Andreas

May 24, 2024 at 4:07 pm #15668607

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

It looks like your "Single Post Page Hero" is not filtering the content per language.

Is this a "GP Premium" Feature?

Would you be able to try to recreate the issue on a test site which I can provide? If "GP Premium" is required to recreate the issue, I will need your assistance in installing the plugin on our test site.

Let me know if this would be possible.

May 24, 2024 at 8:04 pm #15669119

Thomas

Yes, the dynamic field substitutions are in the GP Premium plugin.

And yes, I can help with the GP Premium installation (should I ask the developer for permission before? Haven't the exact licence terms in my mind currently).

T

May 25, 2024 at 12:29 am #15669436

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I was already able to obtain a key for registering the plugin and ran a test on a new test site.

I can confirm an issue with GenerateBlocks and GP Premium Elements on my test site.

I tested with Element Type "Block (Page Hero)".

The issue is related to the GenerateBlocks Dynamic Display conditions.

hidden link

I will need to take a closer look into the code structure of these blocks and then get back to you. If I will not be able to find a solution until tomorrow, I will escalate the issue to our compatibility team.

May 25, 2024 at 10:09 pm #15670522

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

It seems I found a fix for the issue, which will need to be implemented into:

\wp-content\plugins\gp-premium\elements\class-block-elements.php

On line 965:

if ( 'user-meta' === $text_type ) {
$author_id = $this->get_author_id( $source, $block['attrs'] );
$custom_field = $this->get_user_data( $author_id, $block['attrs']['gpDynamicTextCustomField'] );

Change this code to:

if ( 'user-meta' === $text_type ) {
	$author_id = $this->get_author_id( $source, $block['attrs'] );
	$custom_field = $this->get_user_data( $author_id, $block['attrs']['gpDynamicTextCustomField'] );

	// WPML Workaround for compsupp-7392
	if ( class_exists ('Sitepress') && $block['attrs']['gpDynamicTextCustomField'] == 'description') {
		$string_name = 'description_' . $author_id;
		$custom_field = apply_filters( 'wpml_translate_single_string', $custom_field, 'Authors', $string_name );
	}
}

This way the author's description shows up as translated on my test.

I am forwarding this issue to our compatibility which might consider trying to reach the author of GeneratePress so that they can implement this change into "GP Premium".

Once I do have feedback from our team I will contact you again.

May 29, 2024 at 4:30 am #15681604

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Please kindly note that we made a slight adjustment to the workaround.