Planet 8081 fix translations loaded too early#2851
Planet 8081 fix translations loaded too early#2851sagarsdeshmukh wants to merge 2 commits intomainfrom
Conversation
Call __() function after the translations are loaded in memoery
/unhold f672106c-0590-4009-8a5b-f65424381803
Test instance is ready 🚀🌑 mars | admin | blocks report | CircleCI | composer-local.json ⌚ 2026.01.14 08:16:57 |
mardelnet
left a comment
There was a problem hiding this comment.
Hey @sagarsdeshmukh, can you please add to the testing instructions the steps to install the pt_BR language and activate it?
mardelnet
left a comment
There was a problem hiding this comment.
@sagarsdeshmukh, I cannot replicate the error you're trying to fix.
On my local instance, using the main branch and the pt_BR language, the website behaves normally.
However, I still can see this translation issue produced by the WP Stateless plugin:
It seems that the issue with the plugin was solved in version 4.2.1
cc @comzeradd
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the stateless-media domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see [Debugging in WordPress](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/) for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6131 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-includes/functions.php:6131) in /var/www/html/wp-includes/functions.php on line 7182 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-includes/functions.php:6131) in /var/www/html/wp-admin/admin-header.php on line 14
Hmm, I double-checked, and the notice is indeed not reproducible. If you’d like to verify this, you can use the following commands from the local environment root directory(This creates a symlink of the language directory into the WordPress root Since we’re not currently loading translations from the WP root directory, the changes aren’t strictly required, but they still look good to have. What do you think? |
Thanks @sagarsdeshmukh |
Which other language you tried? I will check |
Many, randomly, but mostly English. |
Summary
Notice: A função _load_textdomain_just_in_time foi chamada <strong>incorretamente</strong>. O carregamento da tradução para o domínio <code>planet4-master-theme-backend</code> foi ativado muito cedo. Isso geralmente é um indicador de que algum código no plugin ou tema está sendo executado muito cedo. As traduções devem ser carregadas na ação <code>init</code> ou mais tarde. Leia como <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/ ">Depurar o WordPress</a> para mais informações. (Esta mensagem foi adicionada na versão 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121The notice occurs because translation functions such as __() are being executed before the text domain translations are loaded.
The issue is caused by the MasterSite and MediaReplacer classes calling the __() function too early in the lifecycle.
Ref:
https://greenpeace-planet4.atlassian.net/browse/PLANET-8081
Testing