Making WordPress.org

Changeset 11640


Ignore:
Timestamp:
03/04/2022 03:47:24 AM (4 years ago)
Author:
dd32
Message:

Locale Switcher: use a newer Hook to override the locale earlier, and hook immediately, as some plugins use translation functions upon inclusion.

Handbooks: Don't call translation functions upon plugin inclusion, causing translations to load before plugins are loaded.

See https://github.com/WordPress/wporg-mu-plugins/issues/133

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/callout-boxes.php

    r5465 r11640  
    2323         */
    2424        public function __construct() {
    25                 $this->shortcodes = array(
    26                         'info'    => __( 'Note:',    'wporg' ),
    27                         'tip'     => __( 'Tip:',     'wporg' ),
    28                         'alert'   => __( 'Alert:',   'wporg' ),
    29                         'tutorial' => __( 'Tutorial:', 'wporg' ),
    30                         'warning' => __( 'Warning:', 'wporg' )
    31                 );
    32 
    3325                add_action( 'init', array( $this, 'register_shortcodes' ) );
    3426        }
     
    4032         */
    4133        public function register_shortcodes() {
     34                $this->shortcodes = array(
     35                        'info'     => __( 'Note:',     'wporg' ),
     36                        'tip'      => __( 'Tip:',      'wporg' ),
     37                        'alert'    => __( 'Alert:',    'wporg' ),
     38                        'tutorial' => __( 'Tutorial:', 'wporg' ),
     39                        'warning'  => __( 'Warning:',  'wporg' )
     40                );
     41
    4242                foreach ( array_keys( $this->shortcodes ) as $name) {
    4343                        add_shortcode( $name, array( $this, "{$name}_shortcode" ) );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/locale-detection/locale-detection.php

    r10982 r11640  
    2424        $detector = new Detector();
    2525
    26         add_action( 'locale', [ $detector, 'get_locale' ] );
     26        add_filter( 'locale', [ $detector, 'get_locale' ] );
     27        add_filter( 'pre_determine_locale', [ $detector, 'get_locale' ] );
    2728}
    28 add_action( 'plugins_loaded', __NAMESPACE__ . '\init', 1 );
     29
     30// Override the locale ASAP.
     31init();
Note: See TracChangeset for help on using the changeset viewer.