Make WordPress Core


Ignore:
Timestamp:
11/26/2024 10:14:07 AM (18 months ago)
Author:
swissspidy
Message:

I18N: Load translations just-in-time for custom themes and plugins.

In #34114, just-in-time (JIT) translation loading was implemented for projects hosted on WordPress.org. This is now expanded to all other plugins/themes.

Projects with a custom Text Domain and Domain Path header no longer need to call load_plugin_textdomain() or load_theme_textdomain().

This reduces the risk of calling them too late, after some translation calls already happened, and generally makes it easier to properly internationalize a plugin or theme.

This moves the get_plugin_data() from wp-admin/includes/plugin.php to wp-includes/functions.php so it's available during the plugin loading process.

Props swissspidy.
Fixes #62244.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    r59073 r59461  
    873873                return empty( $theme_name ) ? $template_object->theme : $theme_name;
    874874            case 'plugin':
    875                 if ( ! function_exists( 'get_plugins' ) || ! function_exists( 'get_plugin_data' ) ) {
     875                if ( ! function_exists( 'get_plugins' ) ) {
    876876                    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    877877                }
Note: See TracChangeset for help on using the changeset viewer.