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.

This topic contains 10 replies, has 2 voices.

Last updated by carmenC-14 1 year, 5 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
November 16, 2023 at 3:57 am #14821593

carmenC-14

Hello, I would like to translate a calculator plugin embedded in elementor currently as [custom_dosage_calculator]

i found this documentation https://wpml.org/documentation/support/language-configuration-files/#page-builder-content

and following it i went to the custom xml configuration tab and added this:

<wpml-config>
<shortcodes>
<shortcode>
<tag>custom_dosge_calculator</tag>
<attributes>
<attribute>echo</attribute>
</attributes>
</shortcode>
</shortcodes>
</wpml-config>

It didnt work. What did I do wrong?

The texts are labelled as echo in the plugin, kindly see attached

Screenshot 2023-11-16 at 11.56.07 AM.png
November 16, 2023 at 9:17 am #14823441

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Hi,

Thank you for contacting the support.

The shortcode registration is correct, but, the attribute isn't (perhaps). Because "echo" as an attribute is considered the attribute of the shortcode itself, NOT the echo() function of PHP. For example, if your shortcode looks like this [custom_dosage_calculator echo="some text"] then your XML is correct, otherwise it won't help.

To fix this, you should simply remove unnecessary XML (i.e. attributes) from XML and save. Then:

- Add your shortcode with appropriate attributes (if any) into a simple page for the first time.
- Translate it accordingly.
- In ATE, you 'll need to search for your shortcode to translate itself (https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/).
- If your shortcode has no attributes but you're expecting the strings from the code (i.e. the __("some string")), you'll need to search in String Translation to translate those strings. You may also need to scan your plugin or theme (where this shortcode PHP is added) for WPML to recognize the strings. See following guides:
--- https://wpml.org/documentation/getting-started-guide/string-translation/
--- https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

If you're writing that shortcode yourself, I'll also advise to check the following guides for best practices and WPML compatibility:

- https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/
- https://wpml.org/documentation/support/translating-the-theme-you-created/

Regards.

November 20, 2023 at 1:10 am #14872271

carmenC-14

hello Waqas,

Thanks for the above.

I tried to remove the attributes but it's not working. Couldn't find it in ATE too.

I only found 1 phrase in the String Translation. No other can be detected.

Am exploring the 4th option but the problem is:
1. I am not looking for translation for theme but plugin strings. Will the documentation still apply?
2. I would need help as I am not a coder.. If I paste my plugin scripts here, can you help to provide me the scripts to be added and tell me where to paste it at?

Thanks much!

November 20, 2023 at 6:47 am #14873151

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Thank you for the updates.

Yes, the documentations address the standards, so these should be applicable wherever you're dealing with WordPress stuff.

I can help reviewing the code and suggest accordingly. But please note that custom coding is out of scope of this forum. However, I can give my final suggestion after reviewing the code.

Please let me know.

November 27, 2023 at 1:09 am #14926077

carmenC-14

Hello Waqas,

Thanks for your offer. I'll ask my developer to amend the code for the plugin and then show you over here. Much thanks.

November 27, 2023 at 6:40 am #14926633

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Thank you for the updates. Please take your time and reply when you're ready.

November 29, 2023 at 12:17 pm #14950789
carmenC-14

Hello Waqas,

I need help but this is on another more serious issue. I have been battling with a severe 404 issue on my site, but I always thought it was due to some permalink or ssl issue.

However, today, with my hosting provider's help, I can confirm that it is WPML that's causing the 404 errors.

We deactivated the WPML plugin and then the site works fine.

Scoured through the WPML forum on this issue and I found this, which might be the reason.

https://wpml.org/forums/topic/404-error-for-translations-2/

https://wpml.org/forums/topic/404-error-on-log-in-page/

However, upon checking with the hosting, this is the answers I received:

1. WordPress is installed in a directory (not root) and you're using default links.
- WordPress is installed in the root directory. And we can confirm all the links are correct/

2. URL rewriting is not enabled in your web server.
- mod rewrite is enabled in the server.

3. The web server cannot write to the .htaccess file"
There are no issues in the htaccess.

Kindly assist. We have tried really everything. From re-saving permalinks everyday, to disabling SSL, to testing different plugins.

We need WPML to work soonest possible as it is a major plugin that we rely on.

Thanks,
Carmen

New threads created by Waqas Bin Hasan and linked to this one are listed below:

https://wpml.org/forums/topic/split-severe-404-issue-on-my-site/

November 29, 2023 at 12:43 pm #14951037

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

I've split the 404 related issue into https://wpml.org/forums/topic/split-severe-404-issue-on-my-site/ and our support 'll handle it accordingly. Please follow up on that ticket.

As per our forum policy we can handle only one issue per ticket. So you can get more to the point help, without mixing up several issues in one long ticket.

Please feel free to discuss that shortcode related problem here whenever you're ready.

November 29, 2023 at 1:54 pm #14952155

carmenC-14

Hello Waqas,

Thanks for the links and for the new ticket.

Kindly allow some time for me to read through and send the debug info over.

Appreciate your help!
Carmen

November 30, 2023 at 5:20 am #14957749

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Sure, please take your time and reply when ready.

November 30, 2023 at 5:45 am #14957863

carmenC-14

I have already sent the debug information and some replies at the other ticket. I shall close this ticket to avoid confusion.