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.

Tagged: 

This topic contains 0 reply, has 0 voices.

Last updated by Lauren 1 month, 1 week ago.

Assisted by: Lauren.

Author Posts
April 9, 2025 at 7:55 pm #16915854

johnH-55

Background of the issue:
I am trying to translate a string in footer.php that contains . The strings were found during a scan and translated with string translation. Once I add new languages, everything works as expected. I assume there might be some sort of configuration error in the database. The issue can be seen at hidden link. At home page during debug get_translations_for_domain( $domain ) return empty while other languages or cs-cz at other page show the data.

Symptoms:
The string translation for the homepage at cs-CZ is not working, while other pages and homepages in other languages are working. I expected to see 'Sleduj nás' (translated 'Follow us') at the footer like on hidden link, but instead, I got 'Follow us'.

Questions:
Why is the string translation for the homepage at cs-CZ not working?
Is there a configuration error in the database affecting the string translation?

April 9, 2025 at 9:21 pm #16915984

johnH-55

I found the reason, but not resolution. So, in this page (at home) I have page block which using

switch_to_locale($posts_source['source']['locale']);
do_action('wpml_switch_language', $posts_source['source']['language']);

.... some code....

switch_to_locale($posts_source['original']['locale']);
if ($posts_source['original']['language']) {
do_action('wpml_switch_language', $posts_source['original']['language']); // we hitting gthis.
}

but after this still all looks right.

get_bloginfo('language')
"cs-CZ"
apply_filters('wpml_current_language', null);
"cs-cz"

Likely we dealing with bug where switch_to_locale/wpml_switch_language back to original locale not working as expected.

April 10, 2025 at 12:47 am #16916296

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

It seems that this issue is related to custom coding, which is outside the scope of WPML support. If you can reproduce the issue on a minimal settings (only WPML and a default theme) and the translated text does not display in the footer, then we can further troubleshoot. OTherewise, I can share this documentation https://wpml.org/wpml-hook/wpml_switch_language/ for guidance and if you need further assistance, we can suggest some contractors who are familiar with WPML that may be able to further assist you: https://wpml.org/contractors/