This thread is resolved. Here is a description of the problem and solution.
Problem: The client is using JavaScripts to display pricing tables in different languages (English, Portuguese, Spanish) via shortcodes managed by the WPCode plugin. Despite following the documentation on making shortcodes translatable, the Advanced Translation Editor (ATE) does not recognize these shortcodes for translation. Solution: We recommend creating separate snippets for each language and adding the ID of the English snippet to the original page. Then, use the ATE search bar to find the ID of the original shortcode. Once located, you can translate the pages by searching for the ID of the English snippet and adding the ID of each translated snippet in their respective language. This method should allow the ATE to properly load data from the specific snippets. For further details, you can refer to this video demonstration: https://www.loom.com/share/14acd0e747a5449caff7d84915c86344.
If this solution does not resolve your issue or seems outdated, please check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket for personalized assistance.
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.
Background of the issue:
I am using JavaScripts to display pricing tables, with one table per language (English, Portuguese, Spanish). These scripts are stored in shortcodes using the WPCode plugin: [wpcode=1] for English, [wpcode=2] for Portuguese, [wpcode=3] for Spanish. I need to make these shortcodes translatable in the Advanced Translation Editor, to change the entire shortcode or at least the ID number. I followed the instructions on your site (https://wpml.org/documentation/support/language-configuration-files/translate-custom-shortcodes-with-wpml/#making-shortcodes-translatable) but the Advanced Translation Editor still does not translate them. Here is the XML configuration I used: wpcode id I placed this XML in the WPML settings, the WPCode plugin directory, and the theme root directory. Additionally, I used this code in a custom plugin to avoid modifying the theme functions file: add_filter('wpml_tm_job_field_is_translatable', '__return_true');
Symptoms:
The Advanced Translation Editor does not recognize the shortcodes for translation.
Questions:
Could you please help me identify what I am doing wrong?
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello Pablo,
It looks like the XML code didn't go through, I can't see it.
I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Please, let me know if you need any additional details. Have a nice day.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello Pablo,
Thank you for sharing this information.
I was able to translate the shortcode by searching for its ID inside the Advanced Translation Editor, please check the screenshot.
I couldn't locate the pricing page so I created a test where I added the shortcode, the test is accessible here but I saved it as a draft so it is not visible publicly:
hidden link hidden link
Then I created another snippet and named it Spanish Pricing. Finally, I added its ID to the translation editor then it started loading data from that specific snippet. I looked for other versions of the pricing table but it looks like currently there's only the English version in the scripts.
You can proceed with this method, create two/three snippets, one for each language, you add the English snippet to the original page and translate the other pages searching for the ID of the English snippet. After that you can add the ID of each snippet in their respective language and it should work properly.
Please give it a try and let me know your results.
Great work on making progress with the issue! We're definitely getting closer to a resolution. I've verified that the Spanish version is functioning correctly, as the ID for translation is visible. However, I didn't find the same for the Portuguese version (I've attached screenshots for your reference).
Could you please clarify what adjustments you made to enable the translation ID in Spanish? Understanding these changes will be crucial as I plan to replicate this setup on a fresh installation on another server, and I'll need to replicate each step you've taken.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello Pablo,
Absolutely, I recorded a quick video demonstrating it:
hidden link
In summary, you need to make use of the ATE search bar to look for the ID of the original shortcode, in this case 7584. Once you start typing, ATE will show you that item.
Then you can enter the ID alone of the translated snippet and save it.
For the next times editing the translation, the ID will be there for you to edit without searching for it.