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. Built from https://develop.svn.wordpress.org/branches/4.7@39571 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
edcebaa160
commit
5fa8150d16
|
@ -1776,6 +1776,17 @@ final class WP_Customize_Manager {
|
||||||
}
|
}
|
||||||
$allowed_hosts[] = $host;
|
$allowed_hosts[] = $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$switched_locale = switch_to_locale( get_user_locale() );
|
||||||
|
$l10n = array(
|
||||||
|
'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
|
||||||
|
'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
|
||||||
|
'formUnpreviewable' => __( 'This form is not live-previewable.' ),
|
||||||
|
);
|
||||||
|
if ( $switched_locale ) {
|
||||||
|
restore_previous_locale();
|
||||||
|
}
|
||||||
|
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'changeset' => array(
|
'changeset' => array(
|
||||||
'uuid' => $this->_changeset_uuid,
|
'uuid' => $this->_changeset_uuid,
|
||||||
|
@ -1800,11 +1811,7 @@ final class WP_Customize_Manager {
|
||||||
'activeControls' => array(),
|
'activeControls' => array(),
|
||||||
'settingValidities' => $exported_setting_validities,
|
'settingValidities' => $exported_setting_validities,
|
||||||
'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
|
'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
|
||||||
'l10n' => array(
|
'l10n' => $l10n,
|
||||||
'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
|
|
||||||
'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
|
|
||||||
'formUnpreviewable' => __( 'This form is not live-previewable.' ),
|
|
||||||
),
|
|
||||||
'_dirty' => array_keys( $post_values ),
|
'_dirty' => array_keys( $post_values ),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1123,15 +1123,21 @@ final class WP_Customize_Widgets {
|
||||||
public function export_preview_data() {
|
public function export_preview_data() {
|
||||||
global $wp_registered_sidebars, $wp_registered_widgets;
|
global $wp_registered_sidebars, $wp_registered_widgets;
|
||||||
|
|
||||||
|
$switched_locale = switch_to_locale( get_user_locale() );
|
||||||
|
$l10n = array(
|
||||||
|
'widgetTooltip' => __( 'Shift-click to edit this widget.' ),
|
||||||
|
);
|
||||||
|
if ( $switched_locale ) {
|
||||||
|
restore_previous_locale();
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare Customizer settings to pass to JavaScript.
|
// Prepare Customizer settings to pass to JavaScript.
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
|
'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
|
||||||
'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
|
'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
|
||||||
'registeredSidebars' => array_values( $wp_registered_sidebars ),
|
'registeredSidebars' => array_values( $wp_registered_sidebars ),
|
||||||
'registeredWidgets' => $wp_registered_widgets,
|
'registeredWidgets' => $wp_registered_widgets,
|
||||||
'l10n' => array(
|
'l10n' => $l10n,
|
||||||
'widgetTooltip' => __( 'Shift-click to edit this widget.' ),
|
|
||||||
),
|
|
||||||
'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(),
|
'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(),
|
||||||
);
|
);
|
||||||
foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
|
foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
|
||||||
|
|
|
@ -179,10 +179,8 @@ final class WP_Customize_Selective_Refresh {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$exports = array(
|
$switched_locale = switch_to_locale( get_user_locale() );
|
||||||
'partials' => $partials,
|
$l10n = array(
|
||||||
'renderQueryVar' => self::RENDER_QUERY_VAR,
|
|
||||||
'l10n' => array(
|
|
||||||
'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
|
'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
|
||||||
'clickEditMenu' => __( 'Click to edit this menu.' ),
|
'clickEditMenu' => __( 'Click to edit this menu.' ),
|
||||||
'clickEditWidget' => __( 'Click to edit this widget.' ),
|
'clickEditWidget' => __( 'Click to edit this widget.' ),
|
||||||
|
@ -190,7 +188,15 @@ final class WP_Customize_Selective_Refresh {
|
||||||
'clickEditMisc' => __( 'Click to edit this element.' ),
|
'clickEditMisc' => __( 'Click to edit this element.' ),
|
||||||
/* translators: %s: document.write() */
|
/* translators: %s: document.write() */
|
||||||
'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
|
'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
|
||||||
),
|
);
|
||||||
|
if ( $switched_locale ) {
|
||||||
|
restore_previous_locale();
|
||||||
|
}
|
||||||
|
|
||||||
|
$exports = array(
|
||||||
|
'partials' => $partials,
|
||||||
|
'renderQueryVar' => self::RENDER_QUERY_VAR,
|
||||||
|
'l10n' => $l10n,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Export data to JS.
|
// Export data to JS.
|
||||||
|
|
Loading…
Reference in New Issue