Make WordPress Core


Ignore:
Timestamp:
12/08/2016 07:31:37 PM (8 years ago)
Author:
westonruter
Message:

Customize: Use selected user language for edit shortcuts in preview instead of site language.

Props ocean90.
Fixes #39009.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-selective-refresh.php

    r39144 r39545  
    180180        }
    181181
     182        $switched_locale = switch_to_locale( get_user_locale() );
     183        $l10n = array(
     184            'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
     185            'clickEditMenu' => __( 'Click to edit this menu.' ),
     186            'clickEditWidget' => __( 'Click to edit this widget.' ),
     187            'clickEditTitle' => __( 'Click to edit the site title.' ),
     188            'clickEditMisc' => __( 'Click to edit this element.' ),
     189            /* translators: %s: document.write() */
     190            'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
     191        );
     192        if ( $switched_locale ) {
     193            restore_previous_locale();
     194        }
     195
    182196        $exports = array(
    183197            'partials'       => $partials,
    184198            'renderQueryVar' => self::RENDER_QUERY_VAR,
    185             'l10n'           => array(
    186                 'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
    187                 'clickEditMenu' => __( 'Click to edit this menu.' ),
    188                 'clickEditWidget' => __( 'Click to edit this widget.' ),
    189                 'clickEditTitle' => __( 'Click to edit the site title.' ),
    190                 'clickEditMisc' => __( 'Click to edit this element.' ),
    191                 /* translators: %s: document.write() */
    192                 'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
    193             ),
     199            'l10n'           => $l10n,
    194200        );
    195201
Note: See TracChangeset for help on using the changeset viewer.