Skip Navigation

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 Andrés 1 year, 6 months ago.

Assisted by: Andrés.

Author Posts
October 20, 2022 at 7:27 am

viktoriaJ

Hello!
Some modules and parts of my website are not translated via WPML Translator. I need to add a custom XML Configuration or register these modules. I have already requested support adding these codes, and now I am a bit confused how to add additional ones. Could you please be so kind to help me adding these codes for the following modules?

1) hidden link - services block with photos. The headings and links on photos are not translatable. (screenshot 1)
2) hidden link - price table is not seen in the translator. (screenshot 2)
3) hidden link - how to translate “Send” button in my contact form?

I am ready to provide access to my website.
Thank you for your time and support!

October 20, 2022 at 8:21 am
October 20, 2022 at 8:25 am #12276501

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

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

Hello there,

As we just discussed, we need to render these new widgets compatible. For this please add the plugin Shortcodes by United Themes and try to replica the issue:
hidden link

Once we have a working environment, we will be able to help you.
In the meantime, we also recommend you to contact the theme author.

Regards

October 20, 2022 at 8:53 am #12276749

viktoriaJ

Hello, I have successfully added Shortcodes by United Themes plugin to the test website.

October 20, 2022 at 2:58 pm #12280895

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

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

Thank you for your help. I've created a couple of pages and added the "Princing table" and "Information box" widgets. Please try the following:

- Make a full backup of your site.
- Modify your XML for the following:

<wpml-config>
  <shortcodes>
    <shortcode>
      <tag>ut_service_column_vertical</tag>
      <attributes>
        <attribute>headline</attribute>
      </attributes>
    </shortcode>
    <shortcode>
      <tag>ut_fancy_list</tag>
      <attributes>
        <attribute>list_description</attribute>
        <attribute encoding="urlencoded_json">values</attribute>
      </attributes>
    </shortcode>    
    <shortcode>
      <tag>ut_pricing_table</tag>
      <attributes>
        <attribute>button_text</attribute>
        <attribute>currency</attribute>       
        <attribute type="area" encoding="urlencoded_json">features</attribute>
        <attribute encoding="urlencoded_json">button_link</attribute>
      </attributes>
    </shortcode>
    <shortcode>
      <tag>ut_information_box</tag>
      <attributes>
        <attribute>headline</attribute>
        <attribute type="link" encoding="vc_link">link</attribute>
      </attributes>
    </shortcode>
  </shortcodes>
</wpml-config>

- Add this code into your functions.php file:

add_filter( 'wpml_pb_shortcode_encode', 'wpml_pb_shortcode_encode_urlencoded_json', 10, 3 );
function wpml_pb_shortcode_encode_urlencoded_json( $string, $encoding, $original_string ) {
    if ( 'urlencoded_json' === $encoding ) {
        $output = array();
        foreach ( $original_string as $combined_key => $value ) {
            $parts = explode( '_', $combined_key );
            $i = array_pop( $parts );
            $key = implode( '_', $parts );
            $output[ $i ][ $key ] = $value;
        }
        $string = urlencode( json_encode( $output ) );
    }
    return $string;
}
 
add_filter( 'wpml_pb_shortcode_decode', 'wpml_pb_shortcode_decode_urlencoded_json', 10, 3 );
function wpml_pb_shortcode_decode_urlencoded_json( $string, $encoding, $original_string ) {
    if ( 'urlencoded_json' === $encoding ) {
        $rows = json_decode( urldecode( $original_string ), true );
        $string = array();
        foreach ( $rows as $i => $row ) {
            foreach ( $row as $key => $value ) {
            if ( in_array( $key, array( 'text', 'title', 'features', 'substring', 'btn_text', 'label', 'feature' ) ) ) {
                    $string[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => true );
                } else {
                    $string[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => false );
                }
            }
        }
    }
    return $string;
}

- Refresh your original page and translate it again.

As you can see, it works fine in the Sandbox site, does it work for you?

October 23, 2022 at 9:17 am #12294715

viktoriaJ

Hello,
About the pricing table on the page : hidden link -
The code is not working. With this code I am able to translate some parts of the pricing table (name of the pricing plan and text on the button, and that's it), but not the whole table. The list of services inside the table is still not translatable. Moreover after I have translated the name of the pricing plan and a button text, I've saved the translation - only the button name appeared on the page.

With the information box everything is working now. Thank you!

October 24, 2022 at 6:03 am #12297331

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

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

Hey there,

Could you please create a new page and with a pricing table with all the information that you need to translate?
hidden link

Furthermore, have you contacted and received any updates from the author?

October 24, 2022 at 9:03 am #12298451

viktoriaJ

Hello,
I have tried the following:
1) Created a new page under the name "Test" and created there a block with a pricing table and all the info that I need to translate. After I click "Add Russian translation" from Pages, I see several errors at the top of the page (please see screenshot 1 and 2 attached).
2) I have tried to duplicate the page I have "Website Development" - but when I click "Add Russian translation", again I see errors.

2.png
1.png
October 24, 2022 at 9:05 am #12298501

viktoriaJ

And yes, I have also contacted theme support. Their answer was the following:
"The main issue here is, that these are nested shortcodes. There seems to be a workaround by WMPL which does not seem to work correctly" and that I may try translating it directly from the page switching between languages until a working solution will follow. But it is not really convenient.

October 24, 2022 at 10:23 am #12299369

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

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

Unfortunately you are using your test site. As mentioned before, it works perfectly fine in ours, so could you follow my instructions on the test site I provided for you
hidden link

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