Bundled Themes: Remove load_theme_textdomain() calls from default themes.

Since WordPress 4.6 introduced just-in-time translation loading, themes and plugins no longer need to manually call `load_theme_textdomain`/`load_plugin_textdomain`, unless they are on a version prior to 4.6.

This change removes the `load_theme_textdomain()` call from Twenty Seventeen and up, since these themes all require at least WordPress 4.7.
On older default themes, `load_theme_textdomain()` is called conditionally depending on the WordPress version.

Props piyushtekwani.
Fixes #58318.
Built from https://develop.svn.wordpress.org/trunk@55929


git-svn-id: http://core.svn.wordpress.org/trunk@55441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2023-06-16 13:04:21 +00:00
parent c251d2f8bf
commit 985c726ff3
12 changed files with 60 additions and 39 deletions

View File

@ -79,8 +79,15 @@ if ( ! function_exists( 'twentyeleven_setup' ) ) :
* If you're building a theme based on Twenty Eleven, use
* a find and replace to change 'twentyeleven' to the name
* of your theme in all the template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
}
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();

View File

@ -57,9 +57,17 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
* Make theme available for translation.
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen
* If you're building a theme based on twentyfifteen, use a find and replace
* to change 'twentyfifteen' to the name of your theme in all the template files
* to change 'twentyfifteen' to the name of your theme in all the template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentyfifteen' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentyfifteen' );
}
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

View File

@ -64,8 +64,15 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
* If you're building a theme based on Twenty Fourteen, use a find and
* replace to change 'twentyfourteen' to the name of your theme in all
* template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentyfourteen' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentyfourteen' );
}
/*
* This theme styles the visual editor to resemble the theme style.

View File

@ -26,13 +26,6 @@ if ( ! function_exists( 'twentynineteen_setup' ) ) :
* as indicating support for post thumbnails.
*/
function twentynineteen_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Nineteen, use a find and replace
* to change 'twentynineteen' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentynineteen', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

View File

@ -25,13 +25,6 @@ if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '<' ) ) {
* as indicating support for post thumbnails.
*/
function twentyseventeen_setup() {
/*
* Make theme available for translation.
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyseventeen
* If you're building a theme based on Twenty Seventeen, use a find and replace
* to change 'twentyseventeen' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentyseventeen' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

View File

@ -49,9 +49,16 @@ if ( ! function_exists( 'twentysixteen_setup' ) ) :
* Make theme available for translation.
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentysixteen
* If you're building a theme based on Twenty Sixteen, use a find and replace
* to change 'twentysixteen' to the name of your theme in all the template files
* to change 'twentysixteen' to the name of your theme in all the template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentysixteen' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentysixteen' );
}
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

View File

@ -128,8 +128,15 @@ if ( ! function_exists( 'twentyten_setup' ) ) :
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
}
// This theme uses wp_nav_menu() in one location.
register_nav_menus(

View File

@ -75,8 +75,15 @@ function twentythirteen_setup() {
* If you're building a theme based on Twenty Thirteen, use a find and
* replace to change 'twentythirteen' to the name of your theme in all
* template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentythirteen' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentythirteen' );
}
/*
* This theme styles the visual editor to resemble the theme style,

View File

@ -51,8 +51,15 @@ function twentytwelve_setup() {
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentytwelve
* If you're building a theme based on Twenty Twelve, use a find and replace
* to change 'twentytwelve' to the name of your theme in all the template files.
*
* Manual loading of text domain is not required after the introduction of
* just in time translation loading in WordPress version 4.6.
*
* @ticket 58318
*/
load_theme_textdomain( 'twentytwelve' );
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
load_theme_textdomain( 'twentytwelve' );
}
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();

View File

@ -111,14 +111,6 @@ function twentytwenty_theme_support() {
)
);
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Twenty, use a find and replace
* to change 'twentytwenty' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentytwenty' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );

View File

@ -27,13 +27,6 @@ if ( ! function_exists( 'twenty_twenty_one_setup' ) ) {
* @return void
*/
function twenty_twenty_one_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Twenty-One, use a find and replace
* to change 'twentytwentyone' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentytwentyone', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-55928';
$wp_version = '6.3-alpha-55929';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.