Make WordPress Core

Changeset 55929


Ignore:
Timestamp:
06/16/2023 01:03:00 PM (3 years ago)
Author:
swissspidy
Message:

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.

Location:
trunk/src/wp-content/themes
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/functions.php

    r55476 r55929  
    8080                 * a find and replace to change 'twentyeleven' to the name
    8181                 * of your theme in all the template files.
     82                 *
     83                 * Manual loading of text domain is not required after the introduction of
     84                 * just in time translation loading in WordPress version 4.6.
     85                 *
     86                 * @ticket 58318
    8287                 */
    83                 load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
     88                if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     89                        load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
     90                }
    8491
    8592                // This theme styles the visual editor with editor-style.css to match the theme style.
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r55861 r55929  
    5858                 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen
    5959                 * If you're building a theme based on twentyfifteen, use a find and replace
    60                  * to change 'twentyfifteen' to the name of your theme in all the template files
    61                  */
    62                 load_theme_textdomain( 'twentyfifteen' );
     60                 * to change 'twentyfifteen' to the name of your theme in all the template files.
     61                 *
     62                 * Manual loading of text domain is not required after the introduction of
     63                 * just in time translation loading in WordPress version 4.6.
     64                 *
     65                 * @ticket 58318
     66                 */
     67
     68                if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     69                        load_theme_textdomain( 'twentyfifteen' );
     70                }
    6371
    6472                // Add default posts and comments RSS feed links to head.
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r55861 r55929  
    6565                 * replace to change 'twentyfourteen' to the name of your theme in all
    6666                 * template files.
     67                 *
     68                 * Manual loading of text domain is not required after the introduction of
     69                 * just in time translation loading in WordPress version 4.6.
     70                 *
     71                 * @ticket 58318
    6772                 */
    68                 load_theme_textdomain( 'twentyfourteen' );
     73                if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     74                        load_theme_textdomain( 'twentyfourteen' );
     75                }
    6976
    7077                /*
  • trunk/src/wp-content/themes/twentynineteen/functions.php

    r55861 r55929  
    2727         */
    2828        function twentynineteen_setup() {
    29                 /*
    30                  * Make theme available for translation.
    31                  * Translations can be filed in the /languages/ directory.
    32                  * If you're building a theme based on Twenty Nineteen, use a find and replace
    33                  * to change 'twentynineteen' to the name of your theme in all the template files.
    34                  */
    35                 load_theme_textdomain( 'twentynineteen', get_template_directory() . '/languages' );
    3629
    3730                // Add default posts and comments RSS feed links to head.
  • trunk/src/wp-content/themes/twentyseventeen/functions.php

    r55861 r55929  
    2626 */
    2727function twentyseventeen_setup() {
    28         /*
    29          * Make theme available for translation.
    30          * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyseventeen
    31          * If you're building a theme based on Twenty Seventeen, use a find and replace
    32          * to change 'twentyseventeen' to the name of your theme in all the template files.
    33          */
    34         load_theme_textdomain( 'twentyseventeen' );
    3528
    3629        // Add default posts and comments RSS feed links to head.
  • trunk/src/wp-content/themes/twentysixteen/functions.php

    r55861 r55929  
    5050                 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentysixteen
    5151                 * If you're building a theme based on Twenty Sixteen, use a find and replace
    52                  * to change 'twentysixteen' to the name of your theme in all the template files
    53                  */
    54                 load_theme_textdomain( 'twentysixteen' );
     52                 * to change 'twentysixteen' to the name of your theme in all the template files.
     53                 *
     54                 * Manual loading of text domain is not required after the introduction of
     55                 * just in time translation loading in WordPress version 4.6.
     56                 *
     57                 * @ticket 58318
     58                 */
     59                if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     60                        load_theme_textdomain( 'twentysixteen' );
     61                }
    5562
    5663                // Add default posts and comments RSS feed links to head.
  • trunk/src/wp-content/themes/twentyten/functions.php

    r55420 r55929  
    129129                 * Make theme available for translation.
    130130                 * Translations can be filed in the /languages/ directory.
     131                 *
     132                 * Manual loading of text domain is not required after the introduction of
     133                 * just in time translation loading in WordPress version 4.6.
     134                 *
     135                 * @ticket 58318
    131136                 */
    132                 load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
     137                if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     138                        load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
     139                }
    133140
    134141                // This theme uses wp_nav_menu() in one location.
  • trunk/src/wp-content/themes/twentythirteen/functions.php

    r55861 r55929  
    7676         * replace to change 'twentythirteen' to the name of your theme in all
    7777         * template files.
    78          */
    79         load_theme_textdomain( 'twentythirteen' );
     78         *
     79         * Manual loading of text domain is not required after the introduction of
     80         * just in time translation loading in WordPress version 4.6.
     81         *
     82         * @ticket 58318
     83         */
     84        if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     85                load_theme_textdomain( 'twentythirteen' );
     86        }
    8087
    8188        /*
  • trunk/src/wp-content/themes/twentytwelve/functions.php

    r55476 r55929  
    5252         * If you're building a theme based on Twenty Twelve, use a find and replace
    5353         * to change 'twentytwelve' to the name of your theme in all the template files.
    54          */
    55         load_theme_textdomain( 'twentytwelve' );
     54         *
     55         * Manual loading of text domain is not required after the introduction of
     56         * just in time translation loading in WordPress version 4.6.
     57         *
     58         * @ticket 58318
     59         */
     60        if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
     61                load_theme_textdomain( 'twentytwelve' );
     62        }
    5663
    5764        // This theme styles the visual editor with editor-style.css to match the theme style.
  • trunk/src/wp-content/themes/twentytwenty/functions.php

    r55861 r55929  
    112112        );
    113113
    114         /*
    115          * Make theme available for translation.
    116          * Translations can be filed in the /languages/ directory.
    117          * If you're building a theme based on Twenty Twenty, use a find and replace
    118          * to change 'twentytwenty' to the name of your theme in all the template files.
    119          */
    120         load_theme_textdomain( 'twentytwenty' );
    121 
    122114        // Add support for full and wide align images.
    123115        add_theme_support( 'align-wide' );
  • trunk/src/wp-content/themes/twentytwentyone/functions.php

    r55861 r55929  
    2828         */
    2929        function twenty_twenty_one_setup() {
    30                 /*
    31                  * Make theme available for translation.
    32                  * Translations can be filed in the /languages/ directory.
    33                  * If you're building a theme based on Twenty Twenty-One, use a find and replace
    34                  * to change 'twentytwentyone' to the name of your theme in all the template files.
    35                  */
    36                 load_theme_textdomain( 'twentytwentyone', get_template_directory() . '/languages' );
    3730
    3831                // Add default posts and comments RSS feed links to head.
Note: See TracChangeset for help on using the changeset viewer.