Make WordPress Core


Ignore:
Timestamp:
04/04/2024 01:36:25 PM (2 years ago)
Author:
swissspidy
Message:

I18N: Always search for script translations in wp-content/languages/plugins.

Previously, when WP_PLUGIN_DIR was set to something other than wp-content/plugins, e.g. wp-content/mods, load_script_textdomain was searching for script translations in wp-content/languages/mods. However, that is incorrect, as WP_PLUGIN_DIR does not affect where translations are stored. The location is always wp-content/languages/plugins.

Props coreymckrill, swissspidy.
Fixes #60891.

File:
1 edited

Legend:

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

    r55562 r57922  
    1414         * @ticket 46387
    1515         * @ticket 49145
     16         * @ticket 60891
    1617         *
    1718         * @dataProvider data_resolve_relative_path
     
    122123                                ),
    123124                        ),
     125                        // @ticket 60891
     126                        array(
     127                                '/languages/plugins/internationalized-plugin-en_US-2f86cb96a0233e7cb3b6f03ad573be0b.json',
     128                                'plugin-in-custom-plugin-dir',
     129                                '/wp-content/mods/my-plugin/js/script.js',
     130                                'internationalized-plugin',
     131                                array(
     132                                        'plugins_url',
     133                                        static function () {
     134                                                return 'https://example.com/wp-content/mods';
     135                                        },
     136                                ),
     137                        ),
    124138                );
    125139        }
Note: See TracChangeset for help on using the changeset viewer.