Skip Navigation

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

Problem: The client is unable to find or translate certain hardcoded strings within their theme, specifically in a template partial registered as an ACF block, despite running theme and plugin localization.

Solution: We recommended the client to:
1. Ensure they have a full backup of their website and database.
2. Perform these steps preferably on a staging or development site to avoid issues on the live site.
3. Update WordPress to the latest version.
4. Deactivate all plugins except for WPML and its String Translation add-on.
5. Scan the theme again and then search for the strings in the String Translation section.

Also make sure that for your custom hard-coded texts, these are using proper gettext() methods like _e() or __().

Additionally, we advised checking the guide on finding strings that don't appear on the String Translation page, which can be found here: https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/.

If this solution does not resolve the issue or seems irrelevant due to being outdated or not applicable to your specific case, we highly recommend opening a new support ticket. Please also 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. For further assistance, you can contact us directly at the 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.

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by jeremiahH 1 week ago.

Assisted by: Waqas Bin Hasan.

Author Posts
February 5, 2025 at 11:16 pm #16673235

jeremiahH

Background of the issue:
I am trying to translate some hardcoded strings/text within our theme but cannot seem to find them or know if they have been grabbed and are available for translation. One example is within a template partial registered as an ACF block. It is actually the text on the homepage carousel section that is the H1 text. We ran the theme and plugin localization to run through the theme to attempt to grab the text (as it is hardcoded text) but it doesn't seem to grab it or we cannot locate it in the String Translation nor Translation Management section. Link to a page where the issue can be seen: hidden link

Symptoms:
When we ran the theme localization to grab hardcoded strings, we did see that it found hardcoded strings and listed the template partial, but then going to see the list of strings, the ones we were looking for weren't on the list. For example, 'Connecting shoppers with the brands they love'. I expected to see that running theme localization would pick up hardcoded strings in the template partials. Instead, some came through, but not the ones we were looking for.

Questions:
Why are some hardcoded strings not appearing in the String Translation or Translation Management section?
How can I ensure all hardcoded strings are captured during theme localization?

February 6, 2025 at 8:49 am #16673950

Waqas Bin Hasan
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting the support.

Before proceeding further, can you please try the following?

IMPORTANT: Please take full backup of your website and database beforehand. 

It is highly advised to try this on a staging/dev site first, so your live website isn't compromised.

- Update WordPress to the latest version.
- Deactivate all other plugins except WPML and String Translation.
- And scan the theme again and then search in ST.

I'll also recommend checking other options mentioned in this guide https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/.

Please let me know your findings and I'll try my best to help you further on the matter.

Regards.

February 7, 2025 at 9:09 pm #16681286

jeremiahH

We needed to encase the hardcoded strings in _e().