Skip Navigation

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

Problem: Elementor Buttons not translating the before/after text

Solution: Please update WPML and all its add-ons to their latest versions.

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.

This topic contains 26 replies, has 4 voices.

Last updated by Alejandro 2 months, 1 week ago.

Assigned support staff: Alejandro.

Author Posts
December 12, 2018 at 7:28 pm #2994797

shaneB-8

I am trying to:

Create a button that uses an ACF defined field as the button value. I set the advanced feature text for before (or after) text. When I translate that Elementor page template I am not able to translate this before text

Link to a page where the issue can be seen:

hidden link

I expected to see:

The available translation!

Instead, I got:

The same text in French and English

December 13, 2018 at 3:17 pm #2998415

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!

I suggest you follow the ACF translation guide: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#making-acf-fields-translatable

Try it out and then let me know if the problem still persists, please.

December 22, 2018 at 1:00 pm #3027527

shaneB-8

This doesn't apply as the button text before and after are generated by Elementor. So I believe it's an integration with that duo system

December 24, 2018 at 5:21 pm #3031174

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

I think i know what's going on, the code, though, comes from ACF and not from elementor (it goes through an Elementor element but the info comes from ACF) , elementor only displays them, so i'll take a look at what's going on with ACF + Elementor and let you know.

In the meantime i wish you a very happy holidays!

December 30, 2018 at 2:18 am #3042747

shaneB-8

Great! Happy holidays to yourself as well

January 14, 2019 at 3:11 pm #3088357

shaneB-8

I will test this out tomorrow and give you a report back on whether it is working properly. I was awaiting some financial approval so it got a bit delayed! Happy New Year

January 14, 2019 at 3:46 pm #3088508

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

No problem, let me know!

By the way, we also released a new ACF Multilingual update (1.0.3) which fixed a few bugs with the plugins, please update it as well before you try following my suggestions above.

Regards,
Alejandro.

January 15, 2019 at 6:39 pm #3094412

shaneB-8

After the latest upgrade nothing changes. I can still confirm that indeed the text is not available in the translation interface, and therefore remains in French.

hidden link

January 16, 2019 at 12:53 pm #3097766

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello.

Good news, I think we found the solution to this problem! i'm testing the last things that need to be tested and will get back to you as soon as i can.

In the meantime please update ACF, Advanced Custom Fields Multilingual (as well as our other WPML plugins) and Elementor + Elementor PRO to its last version, otherwise the problem will persist.

I also want to thank you very much for your patience!

January 16, 2019 at 2:37 pm #3098167

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Ok, tests finished and (good) results found.

Please follow the following steps:

1- Go to wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/page-builders-elementor/src/ and edit "class-wpml-elementor-translatable-nodes.php"

2- Find

    'button'      => array(
                'conditions' => array( self::TYPE => 'button' ),
                'fields'     => array(
                    array(
                        'field'       => 'text',
                        'type'        => __( 'Button', 'sitepress' ),
                        'editor_type' => 'LINE'
                    ),
                    'link' => array(
                        'field'       => 'url',
                        'type'        => __( 'Button: Link URL', 'sitepress' ),
                        'editor_type' => 'LINK'
                    ),
                ),
            ),

3- Replace it with

'button'      => array(
                'conditions' => array( self::TYPE => 'button' ),
                'fields'     => array(
                    array(
                        'field'       => 'text',
                        'type'        => __( 'Button', 'sitepress' ),
                        'editor_type' => 'LINE'
                    ),
                    'link' => array(
                        'field'       => 'url',
                        'type'        => __( 'Button: Link URL', 'sitepress' ),
                        'editor_type' => 'LINK'
                    ),
                    array(
                        'field'       => 'before',
                        'type'        => __( 'Before', 'sitepress' ),
                        'editor_type' => 'LINE'
                    ),
                    array(
                        'field'       => 'after',
                        'type'        => __( 'After', 'sitepress' ),
                        'editor_type' => 'LINE'
                    ),
                    array(
                        'field'       => 'fallback',
                        'type'        => __( 'Fallback', 'sitepress' ),
                        'editor_type' => 'LINE'
                    ),
                ),
            ),

That will do it.

We also sent this modification to our developers so it can be merged with one of our future releases but until then, please have this ticket saved somewhere if you update WPML, in case you have to add the code again.

Try it and let me know how it goes.

January 16, 2019 at 2:57 pm #3098222

shaneB-8

I gave it a shot, but unfortunately it is not appearing within the normal WPML translation interface. Thoughts?

January 16, 2019 at 4:33 pm #3098503

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Ok let's check what else could be missing in your configuration:

1) Are the plugins mentioned earlier all updated to their latest versions?
2) Can you go to WPML > Settings and check that the Custom fields related to the suffix and prefix custom group are set to "Translatable" (one of the two options)?
3) in ACF could you select the group and make sure the translation options you can find by scrolling down the page are made to be translated instead of "Do not translate" or "Set as translated" ?
4) in ACF, if you did everything i mentioned in 1-3, you'll now also see each of the fields that are part of the group, in them the prefix, suffix, etc. set them as "translatable" as well.
5) Update the page (add some text or change the name of one of the fields)
6) An update icon will now appear in the translated language option under the "Languages Tab"
7) Try to translate now and you should see the fields now.

January 17, 2019 at 1:50 pm #3102258

shaneB-8

1) Are the plugins mentioned earlier all updated to their latest versions?
Yep it's the same site as the other tickets so it's all been updated including to WordPress 5

2) Can you go to WPML > Settings and check that the Custom fields related to the suffix and prefix custom group are set to "Translatable" (one of the two options)?
It doesn't exist? Do you have any clue what the field would be called... There is one called title_before_desc, but I'm not entirely sure it's that. Or perhaps you meant the actual field 'call_to_purchase', which is being set to Translate already.

3) in ACF could you select the group and make sure the translation options you can find by scrolling down the page are made to be translated instead of "Do not translate" or "Set as translated" ?
In the ACF group they are already set to Make 'Field Groups' translatable. Furthermore, in the actual product it is already set to Translate for that field.

4) in ACF, if you did everything i mentioned in 1-3, you'll now also see each of the fields that are part of the group, in them the prefix, suffix, etc. set them as "translatable" as well.
Hmmm... perhaps this is the catch. Do I need to actually translated the ACF Group? I was under the impression that I don't need to but perhaps that is the missing link??

Since I haven't gotten any of the results at this point where the before/after appear I am just going to hault until we can figure that part out.

5) Update the page (add some text or change the name of one of the fields)
6) An update icon will now appear in the translated language option under the "Languages Tab"
7) Try to translate now and you should see the fields now.

January 17, 2019 at 1:52 pm #3102260

shaneB-8

BTW I'm not sure if the code above was pasted correct btw. I noticed that in some instances you are using keys with arrays and in others you are using array. Could this be linked to the problem or perhaps it is written properly... ?

January 17, 2019 at 4:48 pm #3103059

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

1) Perfect
2) Yes the first one you need to activate is called "call_to_purchase"
3) Perfect
4) It's my fault if you didn't find this option, it's not there anymore. you can now find it in WPML > Settings > Post type Translation > Find and set to "translate" the following:
- Groupes de champs (acf-field-group)

then in WPML > Settings > Custom post field translation > Find and set to "translate" the following:
- call_to_purchase

You can now proceed with the next steps:

5) Update the page (add some text or change the name of one of the fields)
6) An update icon will now appear in the translated language option under the "Languages Tab"
7) Try to translate now and you should see the fields now.

About the code i added above, it's correct, the code itself changed a bit to acommodate the Element widget changes

Let me know how it goes.