Customize: Improve i18n for strings in hidden widget area notices.
Amends [40312]. Props westonruter, ocean90, swissspidy, SergeyBiryukov, michelleweber for copywriting. See #33567, #33052. Fixes #39087. Built from https://develop.svn.wordpress.org/trunk@40330 git-svn-id: http://core.svn.wordpress.org/trunk@40237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d42f8549c
commit
8256ecfecb
|
@ -1616,7 +1616,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
updateNotice = function() {
|
updateNotice = function() {
|
||||||
var activeSectionCount = getActiveSectionCount(), message, nonRenderedAreaCount, registeredAreaCount;
|
var activeSectionCount = getActiveSectionCount(), someRenderedMessage, nonRenderedAreaCount, registeredAreaCount;
|
||||||
noticeContainer.empty();
|
noticeContainer.empty();
|
||||||
|
|
||||||
registeredAreaCount = api.Widgets.data.registeredSidebars.length;
|
registeredAreaCount = api.Widgets.data.registeredSidebars.length;
|
||||||
|
@ -1624,14 +1624,16 @@
|
||||||
|
|
||||||
if ( 0 !== activeSectionCount ) {
|
if ( 0 !== activeSectionCount ) {
|
||||||
nonRenderedAreaCount = registeredAreaCount - activeSectionCount;
|
nonRenderedAreaCount = registeredAreaCount - activeSectionCount;
|
||||||
message = ( 1 === nonRenderedAreaCount ? l10n.someAreasShown.singular : l10n.someAreasShown.plural ).replace( '%d', nonRenderedAreaCount );
|
someRenderedMessage = l10n.someAreasShown[ nonRenderedAreaCount ];
|
||||||
} else {
|
} else {
|
||||||
message = ( 1 === registeredAreaCount ? l10n.noAreasShown.singular : l10n.noAreasShown.plural ).replace( '%d', registeredAreaCount );
|
someRenderedMessage = l10n.noAreasShown;
|
||||||
|
}
|
||||||
|
if ( someRenderedMessage ) {
|
||||||
|
noticeContainer.append( $( '<p></p>', {
|
||||||
|
text: someRenderedMessage
|
||||||
|
} ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
noticeContainer.append( $( '<p></p>', {
|
|
||||||
text: message
|
|
||||||
} ) );
|
|
||||||
noticeContainer.append( $( '<p></p>', {
|
noticeContainer.append( $( '<p></p>', {
|
||||||
text: l10n.navigatePreview
|
text: l10n.navigatePreview
|
||||||
} ) );
|
} ) );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -720,6 +720,47 @@ final class WP_Customize_Widgets {
|
||||||
</div>'
|
</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gather all strings in PHP that may be needed by JS on the client.
|
||||||
|
* Once JS i18n is implemented (in #20491), this can be removed.
|
||||||
|
*/
|
||||||
|
$some_non_rendered_areas_messages = array();
|
||||||
|
$some_non_rendered_areas_messages[1] = html_entity_decode(
|
||||||
|
/* translators: placeholder is the number of other widget areas registered but not rendered */
|
||||||
|
__( 'Your theme has 1 other widget area, but this particular page doesn’t display it.' ),
|
||||||
|
ENT_QUOTES,
|
||||||
|
get_bloginfo( 'charset' )
|
||||||
|
);
|
||||||
|
$registered_sidebar_count = count( $wp_registered_sidebars );
|
||||||
|
for ( $non_rendered_count = 2; $non_rendered_count < $registered_sidebar_count; $non_rendered_count++ ) {
|
||||||
|
$some_non_rendered_areas_messages[ $non_rendered_count ] = html_entity_decode( sprintf(
|
||||||
|
/* translators: placeholder is the number of other widget areas registered but not rendered */
|
||||||
|
_n(
|
||||||
|
'Your theme has %s other widget area, but this particular page doesn’t display it.',
|
||||||
|
'Your theme has %s other widget areas, but this particular page doesn’t display them.',
|
||||||
|
$non_rendered_count
|
||||||
|
),
|
||||||
|
number_format_i18n( $non_rendered_count )
|
||||||
|
), ENT_QUOTES, get_bloginfo( 'charset' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 1 === $registered_sidebar_count ) {
|
||||||
|
$no_areas_shown_message = html_entity_decode( sprintf(
|
||||||
|
/* translators: placeholder is the total number of widget areas registered */
|
||||||
|
__( 'Your theme has 1 widget area, but this particular page doesn’t display it.' )
|
||||||
|
), ENT_QUOTES, get_bloginfo( 'charset' ) );
|
||||||
|
} else {
|
||||||
|
$no_areas_shown_message = html_entity_decode( sprintf(
|
||||||
|
/* translators: placeholder is the total number of widget areas registered */
|
||||||
|
_n(
|
||||||
|
'Your theme has %s widget area, but this particular page doesn’t display it.',
|
||||||
|
'Your theme has %s widget areas, but this particular page doesn’t display them.',
|
||||||
|
$registered_sidebar_count
|
||||||
|
),
|
||||||
|
number_format_i18n( $registered_sidebar_count )
|
||||||
|
), ENT_QUOTES, get_bloginfo( 'charset' ) );
|
||||||
|
}
|
||||||
|
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'registeredSidebars' => array_values( $wp_registered_sidebars ),
|
'registeredSidebars' => array_values( $wp_registered_sidebars ),
|
||||||
'registeredWidgets' => $wp_registered_widgets,
|
'registeredWidgets' => $wp_registered_widgets,
|
||||||
|
@ -733,22 +774,8 @@ final class WP_Customize_Widgets {
|
||||||
'widgetMovedUp' => __( 'Widget moved up' ),
|
'widgetMovedUp' => __( 'Widget moved up' ),
|
||||||
'widgetMovedDown' => __( 'Widget moved down' ),
|
'widgetMovedDown' => __( 'Widget moved down' ),
|
||||||
'navigatePreview' => __( 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.' ),
|
'navigatePreview' => __( 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.' ),
|
||||||
'someAreasShown' => wp_array_slice_assoc(
|
'someAreasShown' => $some_non_rendered_areas_messages,
|
||||||
/* translators: placeholder is the number of other widget areas registered */
|
'noAreasShown' => $no_areas_shown_message,
|
||||||
_n_noop(
|
|
||||||
'Your theme has %d other widget area, but this particular page doesn\'t display it.',
|
|
||||||
'Your theme has %d other widget areas, but this particular page doesn\'t display them.'
|
|
||||||
),
|
|
||||||
array( 'singular', 'plural' )
|
|
||||||
),
|
|
||||||
'noAreasShown' => wp_array_slice_assoc(
|
|
||||||
/* translators: placeholder is the total number of widget areas registered */
|
|
||||||
_n_noop(
|
|
||||||
'Your theme has %d widget area, but this particular page doesn\'t display it.',
|
|
||||||
'Your theme has %d widget areas, but this particular page doesn\'t display them.'
|
|
||||||
),
|
|
||||||
array( 'singular', 'plural' )
|
|
||||||
),
|
|
||||||
'reorderModeOn' => __( 'Reorder mode enabled' ),
|
'reorderModeOn' => __( 'Reorder mode enabled' ),
|
||||||
'reorderModeOff' => __( 'Reorder mode closed' ),
|
'reorderModeOff' => __( 'Reorder mode closed' ),
|
||||||
'reorderLabelOn' => esc_attr__( 'Reorder widgets' ),
|
'reorderLabelOn' => esc_attr__( 'Reorder widgets' ),
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40324';
|
$wp_version = '4.8-alpha-40330';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue