This thread is resolved. Here is a description of the problem and solution.
Problem:
You are working on a site under development and need to translate static content in PHP files and error messages in JavaScript.
Solution:
For translating static content in PHP files, we recommend using WPML's String Translation. Ensure that the text within your PHP files is wrapped in WordPress localization functions like
__()
or
_e()
. This allows WPML to recognize these strings and enables translation directly from the WordPress dashboard. For a step-by-step guide, please visit: https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/
For translating error messages in JavaScript, utilize WPML's JavaScript Translation capabilities. Ensure your scripts are set up to work with WPML's string translation by registering your JavaScript strings with WPML. For more details, check out these resources:
- https://wpml.org/forums/topic/how-to-translate-javascript-strings/#post-13131375
- https://stackoverflow.com/questions/66437622/how-can-i-translate-html-text-that-in-javascript-using-wpml
If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket at WPML support forum.
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 1 reply, has 2 voices.
Last updated by 6 months, 1 week ago.
Assisted by: Mihai Apetrei.