Make WordPress Core


Ignore:
Timestamp:
11/20/2024 02:48:40 AM (2 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n/wpTextdomainRegistry.php

    r57831 r59430  
    4040                        'Incorrect availability status for textdomain with custom path'
    4141                );
    42                 $this->assertFalse(
     42                $this->assertSame(
     43                        WP_LANG_DIR . '/bar/',
    4344                        $this->instance->get( 'foo', 'en_US' ),
    44                         'Should not return custom path for textdomain and en_US locale'
     45                        'Should return custom path for textdomain and en_US locale'
    4546                );
    4647                $this->assertSame(
Note: See TracChangeset for help on using the changeset viewer.