This thread is resolved. Here is a description of the problem and solution.
Problem: The client modified the English part of a string in their custom theme's PHP file and updated the translation in WPML, but the Polish tag archive pages still displayed the untranslated string 'Sorted articles by'. Solution: 1. Ensure that all WPML plugins are updated to the latest versions and check if the issue persists when all other plugins are disabled, using only WPML plugins. 2. Test the translation of the modified string on different pages and with the default WordPress theme, such as 2021, to see if the issue is specific to the custom theme. 3. Replace the variable in the gettext function with a literal string for the text domain in the PHP file:
4. Rescan the theme for strings in WPML under 'Theme and plugins localization' and then translate the strings again in 'String Translation'. For more details on enabling text translation for themes not compatible with WPML, visit https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/. If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, please open a new support ticket. 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. For further assistance, you can also visit our support forum at https://wpml.org/forums/forum/english-support/.
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.
Our next available supporter will start replying to tickets in about 0.81 hours from now. Thank you for your understanding.
Background of the issue:
I have tag archive pages on my site, such as hidden link. The title 'Tag archives' was translated correctly before. I modified the English part in the file /includes/locals.php from 'tag_archives' => __('Tag Archives', $domain), to 'tag_archives' => __('Sorted articles by', $domain). I then rescanned the theme for new strings and translated 'Sorted articles by' in the 'String translation' section.
Symptoms:
The Polish tag archive pages still show the untranslated string 'Sorted articles by'.
Questions:
Why is the Polish tag archive page still showing the untranslated string?
How can I ensure the translation for 'Sorted articles by' is applied correctly?
While you wait for my colleague to take over the ticket, let me try to help you with the issue quickly.
1) Please make sure to update WPML plugins to the latest versions, and check if the issue still happens when all other plugins are disabled while using only WPML plugins.
2) I see you are using a custom theme, so this could be difficult to debug for us from WPML support. Can you try to test if the translation of your string works fine on some other page and on that archive if you use example from our guide:
1) Plugins updated
2) yes, gettext are working fine. It's a huge site and it's already translated more than 90%. Both normal strings and gettext work fine. Only in this specific case somehting is not working. But BEFORE chaning the ` 'tag_archives' => __('Sorted articles by', $domain)` line the string translation was working here. I just wanted to have the English version differ than what was in PHP.
3) Yes, they work fine in this custom theme and in default wp theme. Only this specific string is not working.
I would like to request temporary access (wp-admin and FTP) to your site so I can take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.
I am using this theme since almost 10 years. And they were being translated well. And still the rest of strings with $domain) are being translated well. Only this one stopped working and needs to be writtem as 'tag_archives' => __('Sorted articles by', 'cherry'),
I'm not sure when exactly the change/update was released and affected your theme but you can see in the WordPress documentation, you should use a literal string for the text domain. For other strings, I think it is generated for the .mo file and has worked in the past. But now, if you change another string in the file locals.php and re-scan the theme, it doesn't work as the string "Sorted articles by".
Generally, please use a literal string for the text domain to allow WPML to scan and translate strings in your files correctly.