Skip Navigation

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

Problem:
Core html block with shortcode not translateable

Solution:
Shortcodes having numbers in their attributes can either be found in the string translation (search for the number value) or add the following code in your theme's functions.php file to be able search/translate in ATE:

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

Relevant Documentation:
https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/

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 9 replies, has 3 voices.

Last updated by Thomas 1 year, 6 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 25, 2023 at 2:21 pm #14292555

Thomas

Hi there,
I use the core html block to integrate shortcodes on my site. Like this:
[fluentform id="2"]
[kadence_element id="1311"]

When I translate the page, the core/html block is not visible. When I use the wpml search to search for example the shortcode "fluent" (see my attached images) I can only find a fraction of the shortcode. I tried to search "2" or 1311 but without success.

1. It is not possible to translate the content of a html block. I tried it with different ones.

2. Instead of the html block I tried it with the core shortcode block. But it is the same.

3. I used string translation to search the shortcodes. I found them and translated them. BUT when I update the page, my translated strings are resetted...

4. Is it somehow possible to show all the content in the advanced translation overview?

5. Why is this happening?

Thank you,
Thomas

html-core-block-shortcode-01.jpg
html-core-block-shortcode-03.jpg
html-core-block-shortcode-02.jpg
August 28, 2023 at 6:14 am #14297243

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Thomas,

it is not possible out of the box via WPML, since the shortcode and numbers should be same on the translated page. Also translating the page via WPML string translation will not work, that is expected.

Anyway, you can use a small workaround from the next ticket:

- Add the correct XML code for this shortcode
- Add custom function code function wpmlsupp_7499_allow_translating_numbers
- Add your shortcode to text block wrapped in HTML

Please check:
- https://wpml.org/forums/topic/translate-numbers-in-shortcodes/

Regards,
Drazen

August 28, 2023 at 6:32 am #14297275

Thomas

Hi,
is it possible to make the standard gutenberg HTML block available for translating? I have different shortcodes added with the html block with different shortcodes. Is there a better solution to edit every page and add <div></div> to all gutenberg html blocks? I Don't use the automatic translation option and want to be able to change the content of the gutenberg html blocks.

Thank you,
Thomas

August 28, 2023 at 6:52 am #14297427

Thomas

I tried this without success:

<wpml-config>
<shortcodes>
<shortcode>
<tag label="Fluent Forms">fluentform</tag>
<attributes>
<attribute label="Fluent Forms ID">id</attribute>
</attributes>
</shortcode>
</shortcodes>
</wpml-config>

I searched for "fluent" in the ATE but found nothing.

Shortcode is added via html gutenberg block. Like you can see it in my first post.

August 28, 2023 at 11:59 am #14300405

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Thomas,

Thank you for contacting the support. I am assigned this ticket and 'll try my best to help you fix the problem.

For correct syntax of registering shortcodes, please see https://wpml.org/documentation/support/language-configuration-files/#1-1-translate-strings:

<wpml-config>
  <shortcodes>
    <shortcode>
        <tag>fluentform</tag>
        <attributes>
            <attribute>id</attribute>
        </attributes>
    </shortcode>
  </shortcodes>
</wpml-config>

If this doesn't resolve the problem, then I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.

Your next answer will be private, to share this information safely.

Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend.

IMPORTANT: Please take a complete backup of the site to avoid data loss.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

Regards.

August 29, 2023 at 7:48 am #14304649

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for providing the access. I am working on it and 'll get back to you accordingly.

August 29, 2023 at 12:22 pm #14307023

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I checked in your staging site and added those shortcodes in 2 different pages:

- Test WPML -> using Shortcode Blocks
- Test wpml 2 -> using Custom HTML Block

Then I was able to find the IDs and attributes of these in String Translation (see attached).

I translated these pages also and experimented the translated ID for dearpdf shortcode at hidden link. For German page I used 99999999 while translated for English using 888888888. And I can see the ID correctly used on the frontend (see attached).

To check it further to be able to translate IDs in ATE, I added following code in your current theme's functions.php file (as pointed earlier to https://wpml.org/forums/topic/translate-numbers-in-shortcodes/#post-12429453):

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

Then translated the page and I could see in ATE (see attached ate.jpg). I used 77777777 this time and could see it reflected on English translation also (see attached), which was reflected in ST also (see ate-st.jpg).

So I think it is working fine, please check and confirm.

ate-st.jpg
shortcode trans ate.jpg
ate.jpg
shortcodes.jpg
shortcode translation.jpg
shortcode st.jpg
August 29, 2023 at 12:31 pm #14307191

Thomas

So I had to add this filter to see the IDs?
add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );
?

August 29, 2023 at 12:53 pm #14307339

Thomas

I think the code is doing nothing, I removed it. I have to search directly for the number and not for "ID". But thanks anyway.

August 29, 2023 at 1:11 pm #14307473

Thomas

IM SO SORRY! Totally my fault I have to add:
add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );
otherwise I'm not able to translate the strings.
5star support. Please adjust my rating.
IM SO SORRY!