Skip Navigation

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

Problem:
You are trying to translate a static .twig file in your theme using WPML, but the homepage isn't translating while other pages do.
Solution:
First, ensure that you enable the option to scan these strings. You can register the twig strings using the

getText()

function, prepared as shown below:

{{ __(\'Example heading to translate\', \'example-domain\') }}

Additionally, in the latest version of WPML, you can scan them directly from the WPML Translation Management. There is now a string section available for this purpose. You can learn more about this process in this video: https://wpml.org/documentation/getting-started-guide/string-translation/.

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. Should you need further 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.

Tagged: 

This topic contains 3 replies, has 0 voices.

Last updated by Marcel 1 week ago.

Assisted by: Marcel.

Author Posts
April 2, 2025 at 9:51 pm #16889253

reedL

Background of the issue:
I am trying to translate my homepage which is a static .twig file on my theme, Timberland. Most other pages translate but not our homepage. I am using WPML for translations.

Symptoms:
The homepage isn't translating, while other pages do.

Questions:
How can I translate a static .twig file in my theme using WPML?

April 4, 2025 at 9:58 am #16896594

Marcel
WPML Supporter since 02/2019

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

You can try enabling the option to scan these strings as described in this thread:
https://wpml.org/forums/topic/wpml-scan-doesnt-find-string-in-twig-template-files/

This will register the twig strings using the getText() function, if they are prepared as shown here:

{{ __('Example heading to translate', 'example-domain') }}

Best regards,
Marcel

April 8, 2025 at 7:11 pm #16910707

reedL

Thank for your response, Marcel. I have reviews the linked thread and I am having some issues..

I have tried the following:
"WPML -> String Translation and enable the option: Look for strings while pages are rendered."

I do not see an option for "Look for strings while pages are rendered", however I see an option for "Track where strings appear on the site" which I have enabled. I then go to the homepage, but nothing comes up.

April 9, 2025 at 7:45 am #16911715

Marcel
WPML Supporter since 02/2019

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

in the latest version, you can scan them directly from the WPML Translation Management, as there is now a string section. You can see it in this video: https://wpml.org/documentation/getting-started-guide/string-translation/.

Best Regards,
Marcel