Skip Navigation

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

Problem:
Would like to translate the gravity forms shortcode ID

Solution:
I've checked, and to allow translation of the gravity form ID, I've inserted this custom XML configuration below here

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

Then, I've inserted the PHP code below to remove the "numbers" filter from the translation management. This code should be added to the theme's functions.php file

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
    if ( is_numeric( $data ) ) {
        return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

Now, you should be able to translate the ID as shown in the attached screenshot. Remember to make minor edits to the primary language page to refresh the "Advanced Translation Editor" contents.

Relevant Documentation:

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

Last updated by aitorZ 1 year, 9 months ago.

Assisted by: Kor.

Author Posts
June 29, 2022 at 9:16 am #11565435

aitorZ

Hi, Let's see if I can explain it in a simple way. I use Gravity forms with some Addons like "Conditional pricing", "Conditional dates" and "Payment gateways" but, these features don't work in the form translated by "Gravity forms multilingual" plugin.

To have this functionality, I must create the form in both languages ​​and therefore I must enter the different gravity "Shortcode" of each language in the corresponding page.

What is happening? That if I make any changes to the original page, when saving, the "Shortcode" of the translated page also changes and I don't know how I can solve this so I don't have to access the translated page again to change the shortcode ID.

In the "String translation" section it shows me some shortcodes but not all of them and in the ATE they are not shown.

Is there a way I can translate these shortcodes so I don't have to manually change them every time I update the original content?

Thank you very much.

June 29, 2022 at 10:18 am #11566403

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for contacting WPML support.

I believe these Gravity forms addons like "Conditional pricing", "Conditional dates" and "Payment gateways" uses a custom field and if it's configured as "Copy" as explained here https://wpml.org/documentation/getting-started-guide/translating-custom-fields/#indicating-which-custom-fields-to-translate

So, any changes you made to the primary language fields will be copied over to the translated field.

To prevent this from happening, could you try searching for the custom field in WPML > Settings > Custom Field Translation > and configure it as "Translate"

Then, check/translate it again and see if it works for you?

I hope it helps and let me know how it goes.

Thanks!

Kor

June 30, 2022 at 5:39 am #11572199

aitorZ

Hi Kor, thanks for your answer.

I think I didn't explain myself well. The important part is that I have to create different shortcodes for each language and that when I refresh the original language page, I lose the shortcode of the translated page, since it overwrites it.

I need to show these shortcodes in the ATE instead of "false" which is what it shows now.

The shortcodes entered in the custom fields are not displayed in the string translator, that's why I need them in the ATE to translate them at the time of doing the page translation.

The shortcodes have the following format and in Spanish it contains an ID and in English another.

[gravityform id="12" title="false" description="false"]

Thank you

ATE-shortcode.jpg
July 1, 2022 at 3:59 am #11582009

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for your reply.

I don't think ATE will display the full shortcode when translating. But I think it could be possible to display the "ID" on ATE and then, you can translate it. Would it meet your requirements?

Anyway, please share temporary access (WP-Admin and FTP) to your Website so that I could check and see if we can use some other methods to achieve what you needed there.

IMPORTANT: Please, note, a backup is required for security reasons, and to avoid any data loss, you can use the https://wordpress.org/plugins/updraftplus/ plugin for these backup needs.

Your following answer will be private, which means only you and I have access to it.

✙ I would need your permission to de-activate and re-activate Plugins and the Theme and to change configurations on the site if required. This is also a reason the backup is critical.

Also, I noticed that your “WP Memory Limit” PHP limit is below the required 128MB or recommended 256MB as described at: https://wpml.org/home/minimum-requirements/ . Could you please contact your hosting provider and ask them to increase this PHP value for you and also, ask them to update the MySQL version to 5.6+?

Let me know how it goes.

Thanks!

Kor

July 1, 2022 at 5:24 pm #11586889

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for your reply.

Sorry, I'm being locked from accessing your Website WP admin access page as shown in the attached screenshot. Could you check on it?

Thanks!

Kor

Screen Shot 2022-07-02 at 1.23.07 AM.jpg
July 1, 2022 at 5:28 pm #11586919

aitorZ

Hi Kor, From which country are you trying to connect? Could you provide me your IP to indicate it to the server?

July 1, 2022 at 5:40 pm #11586955

aitorZ

I have given permission to Malaysia and your IP to access FTP.
Try now please

July 4, 2022 at 7:46 am #11595193

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for your reply.

I'm able to access your Website now and could you tell me which page can I see the shortcode shown in the attached screenshot that you shared earlier? Please share the URL of the page in question here and I will check on it.

Thanks!

Kor

July 4, 2022 at 8:05 am #11595335

aitorZ

There are tons of shortcodes. These are for displaying the forms in pop-up mode via a modal on button click.

All pages that have to do with training use these buttons:

hidden link
hidden link
hidden link
hidden link

Also webinars and workshops:

hidden link
hidden link

and in continuous training:

hidden link
hidden link one doesn't need translation)

July 5, 2022 at 10:55 am #11604427

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for your patience.

I've checked, and to allow translation of the gravity form ID, I've inserted this custom XML configuration below here hidden link

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

Then, I've inserted the PHP code below to remove the "numbers" filter from the translation management. This code should be added to the theme's functions.php file, but since I cannot access the theme files, I've installed the "Code Snippet" plugin and added it here hidden link

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
    if ( is_numeric( $data ) ) {
        return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

Now, you should be able to translate the ID as shown in the attached screenshot. Remember to make minor edits to the primary language page to refresh the "Advanced Translation Editor" contents. hidden link

Thanks!

Kor

Screen Shot 2022-07-05 at 6.50.51 PM.jpg
July 5, 2022 at 12:07 pm #11605305

aitorZ

Hey!!! You've saved me a lot of lost time working on translations.

Wpml should insert this functionality by default.

Many thanks.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.