Skip Navigation

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

Problem:
You are preparing your theme for translation and have encountered difficulty registering hardcoded image alt tags as single strings for translation.
Solution:
To register hardcoded image alt tags in your theme for translation, you need to wrap these strings with a GETTEXT call. We recommend reading our guide for developers on how to use GETTEXT for more detailed instructions: https://wpml.org/documentation/support/how-to-use-gettext/
If you require further assistance or have additional questions, please provide your site's Debug information. You can find guidance on how to do this here: http://wpml.org/faq/provide-debug-information-faster-support/

Please note that this solution might be outdated or not applicable to your specific case. 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 the issue persists, 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 0 voices.

Last updated by jeremiahH 2 weeks, 6 days ago.

Assisted by: Itamar.

Author Posts
March 20, 2025 at 5:51 pm #16841516

jeremiahH

Background of the issue:
We have not yet begun translation but are in the process of preparing the theme to grab hardcoded strings. We have a couple of images that are in the theme and we have added alt tags to them. I'm having difficulty registering them as a single string to be available for translation. I believe that if we have the image hardcoded in the theme, it will copy to new languages which is fine, we just want the alt text translated. These images are not in media, they are in the theme.

Symptoms:
Difficulty registering hardcoded image alt tags as a single string for translation.

Questions:
How can I register hardcoded image alt tags in the theme for translation using WPML?

March 23, 2025 at 10:35 pm #16849395

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

You must wrap any hard-coded strings, including alt text, with a GETTEXT call. Please read about it in the following guide for developers.

https://wpml.org/documentation/support/how-to-use-gettext/

Please let me know if you have any further questions.

Please share your site's Debug information if you need further help with this issue. You can read about it here.

http://wpml.org/faq/provide-debug-information-faster-support/

Regards,
Itamar.

March 24, 2025 at 5:42 pm #16853612

jeremiahH

Thank you! I was able to grab the alt tag now.