summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/data
diff options
context:
space:
mode:
authorJonathan Desrosiers <desrosj@git.wordpress.org>2024-11-20 02:48:40 +0000
committerJonathan Desrosiers <desrosj@git.wordpress.org>2024-11-20 02:48:40 +0000
commit193f6eb26e65216576a10492dd4103044c3a079c (patch)
tree84e0671d5b53ea4cbfe954fae7732927dcddfe2c /tests/phpunit/data
parent9b6229463b1eaee92bcde71341fa96ceb344b383 (diff)
downloadwordpress-193f6eb26e65216576a10492dd4103044c3a079c.tar.gz
wordpress-193f6eb26e65216576a10492dd4103044c3a079c.zip
i18n: Account for `load_*_textdomain()` after JIT loading.
When `load_*_textdomain()` functions are called after WordPress has already attempted just-in-time loading of translations, nothing happens. This updates the related logic to retry translation loading when a custom path is set to ensure all translations are available. Additionally, this also fixes cases where an `en_US.mo` file is provided with non-English strings to override the default language. Follow up to [59157]. Props swissspidy, peterwilsoncc, desrosj, apermo, sergeybiryukov, wildworks, tigriweb, twvania, looswebstudio, stimul, audrasjb, finntown, bluantinoo, timwhitlock, albigdd. See #62337. git-svn-id: https://develop.svn.wordpress.org/trunk@59430 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tests/phpunit/data')
-rw-r--r--tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php b/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php
index 41eb593556..c7d1c0d5e4 100644
--- a/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php
+++ b/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php
@@ -7,7 +7,11 @@ Version: 1.0.0
Text Domain: custom-internationalized-plugin
*/
-load_plugin_textdomain( 'custom-internationalized-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
+function custom_i18n_load_textdomain() {
+ load_plugin_textdomain( 'custom-internationalized-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
+}
+
+add_action( 'init', 'custom_i18n_load_textdomain' );
function custom_i18n_plugin_test() {
return __( 'This is a dummy plugin', 'custom-internationalized-plugin' );