Make WordPress Core


Ignore:
Timestamp:
02/01/2024 07:03:55 PM (16 months ago)
Author:
swissspidy
Message:

I18N: Support loading .l10n.php translation files on their own.

Adjusts the translation file lookup in WP_Textdomain_Registry so that just-in-time translation loading
works even if there is only a .l10n.php translation file without a corresponding .mo file.

While language packs continue to contain both file types, this makes it easier to use translations in a project
without having to deal with .mo or .po files.

Props Chrystl.
See #59656.

File:
1 edited

Legend:

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

    r57299 r57516  
    152152    public function data_domains_locales() {
    153153        return array(
    154             'Non-existent plugin'            => array(
     154            'Non-existent plugin'                      => array(
    155155                'unknown-plugin',
    156156                'en_US',
    157157                false,
    158158            ),
    159             'Non-existent plugin with de_DE' => array(
     159            'Non-existent plugin with de_DE'           => array(
    160160                'unknown-plugin',
    161161                'de_DE',
    162162                false,
    163163            ),
    164             'Available de_DE translations'   => array(
     164            'Available de_DE translations'             => array(
    165165                'internationalized-plugin',
    166166                'de_DE',
    167167                WP_LANG_DIR . '/plugins/',
    168168            ),
    169             'Available es_ES translations'   => array(
     169            'Available es_ES translations'             => array(
    170170                'internationalized-plugin',
    171171                'es_ES',
    172172                WP_LANG_DIR . '/plugins/',
    173173            ),
    174             'Unavailable fr_FR translations' => array(
     174            'Unavailable fr_FR translations'           => array(
    175175                'internationalized-plugin',
    176176                'fr_FR',
    177177                false,
    178178            ),
    179             'Unavailable en_US translations' => array(
     179            'Unavailable en_US translations'           => array(
    180180                'internationalized-plugin',
    181181                'en_US',
    182182                false,
    183183            ),
     184            'Available de_DE translations (.l10n.php)' => array(
     185                'internationalized-plugin-2',
     186                'de_DE',
     187                WP_LANG_DIR . '/plugins/',
     188            ),
     189            'Available es_ES translations (.l10n.php)' => array(
     190                'internationalized-plugin-2',
     191                'es_ES',
     192                WP_LANG_DIR . '/plugins/',
     193            ),
    184194        );
    185195    }
Note: See TracChangeset for help on using the changeset viewer.