Make WordPress Core

Changeset 39571


Ignore:
Timestamp:
12/12/2016 01:58:21 AM (10 years ago)
Author:
dd32
Message:

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

Props ocean90.
Merges [39545] to the 4.7 branch.
Fixes #39009.

Location:
branches/4.7
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/class-wp-customize-manager.php

    r39507 r39571  
    17771777                        $allowed_hosts[] = $host;
    17781778                }
     1779
     1780                $switched_locale = switch_to_locale( get_user_locale() );
     1781                $l10n = array(
     1782                        'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
     1783                        'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
     1784                        'formUnpreviewable' => __( 'This form is not live-previewable.' ),
     1785                );
     1786                if ( $switched_locale ) {
     1787                        restore_previous_locale();
     1788                }
     1789
    17791790                $settings = array(
    17801791                        'changeset' => array(
     
    18011812                        'settingValidities' => $exported_setting_validities,
    18021813                        'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
    1803                         'l10n' => array(
    1804                                 'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
    1805                                 'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
    1806                                 'formUnpreviewable' => __( 'This form is not live-previewable.' ),
    1807                         ),
     1814                        'l10n' => $l10n,
    18081815                        '_dirty' => array_keys( $post_values ),
    18091816                );
  • branches/4.7/src/wp-includes/class-wp-customize-widgets.php

    r38810 r39571  
    11241124                global $wp_registered_sidebars, $wp_registered_widgets;
    11251125
     1126                $switched_locale = switch_to_locale( get_user_locale() );
     1127                $l10n = array(
     1128                        'widgetTooltip'  => __( 'Shift-click to edit this widget.' ),
     1129                );
     1130                if ( $switched_locale ) {
     1131                        restore_previous_locale();
     1132                }
     1133
    11261134                // Prepare Customizer settings to pass to JavaScript.
    11271135                $settings = array(
     
    11301138                        'registeredSidebars' => array_values( $wp_registered_sidebars ),
    11311139                        'registeredWidgets'  => $wp_registered_widgets,
    1132                         'l10n'               => array(
    1133                                 'widgetTooltip'  => __( 'Shift-click to edit this widget.' ),
    1134                         ),
     1140                        'l10n'               => $l10n,
    11351141                        'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(),
    11361142                );
  • branches/4.7/src/wp-includes/customize/class-wp-customize-selective-refresh.php

    r39144 r39571  
    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.