diff --git src/wp-admin/js/customize-widgets.js src/wp-admin/js/customize-widgets.js
index d3a4edcc64..b482e8d607 100644
|
|
|
1616 | 1616 | * @returns {void} |
1617 | 1617 | */ |
1618 | 1618 | updateNotice = function() { |
1619 | | var activeSectionCount = getActiveSectionCount(), message, nonRenderedAreaCount, registeredAreaCount; |
| 1619 | var activeSectionCount = getActiveSectionCount(), someRenderedMessage, nonRenderedAreaCount, registeredAreaCount; |
1620 | 1620 | noticeContainer.empty(); |
1621 | 1621 | |
1622 | 1622 | registeredAreaCount = api.Widgets.data.registeredSidebars.length; |
… |
… |
|
1624 | 1624 | |
1625 | 1625 | if ( 0 !== activeSectionCount ) { |
1626 | 1626 | nonRenderedAreaCount = registeredAreaCount - activeSectionCount; |
1627 | | message = ( 1 === nonRenderedAreaCount ? l10n.someAreasShown.singular : l10n.someAreasShown.plural ).replace( '%d', nonRenderedAreaCount ); |
| 1627 | someRenderedMessage = l10n.someAreasShown[ nonRenderedAreaCount ]; |
1628 | 1628 | } else { |
1629 | | message = ( 1 === registeredAreaCount ? l10n.noAreasShown.singular : l10n.noAreasShown.plural ).replace( '%d', registeredAreaCount ); |
| 1629 | someRenderedMessage = l10n.noAreasShown; |
| 1630 | } |
| 1631 | if ( someRenderedMessage ) { |
| 1632 | noticeContainer.append( $( '<p></p>', { |
| 1633 | text: someRenderedMessage |
| 1634 | } ) ); |
1630 | 1635 | } |
1631 | 1636 | |
1632 | 1637 | noticeContainer.append( $( '<p></p>', { |
1633 | | text: message |
1634 | | } ) ); |
1635 | | noticeContainer.append( $( '<p></p>', { |
1636 | 1638 | text: l10n.navigatePreview |
1637 | 1639 | } ) ); |
1638 | 1640 | } |
diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
index 887c11fa0c..c6c378053a 100644
|
|
final class WP_Customize_Widgets { |
720 | 720 | </div>' |
721 | 721 | ); |
722 | 722 | |
| 723 | /* |
| 724 | * Gather all strings in PHP that may be needed by JS on the client. |
| 725 | * Once JS i18n is implemented (in #20491), this can be removed. |
| 726 | */ |
| 727 | $some_non_rendered_areas_messages = array(); |
| 728 | $registered_sidebar_count = count( $wp_registered_sidebars ); |
| 729 | for ( $non_rendered_count = 1; $non_rendered_count < $registered_sidebar_count; $non_rendered_count++ ) { |
| 730 | $some_non_rendered_areas_messages[ $non_rendered_count ] = html_entity_decode( sprintf( |
| 731 | /* translators: placeholder is the number of other widget areas registered but not rendered */ |
| 732 | _n( |
| 733 | 'Your theme has %s other widget area, but this particular page doesn’t display it.', |
| 734 | 'Your theme has %s other widget areas, but this particular page doesn’t display them.', |
| 735 | $non_rendered_count |
| 736 | ), |
| 737 | number_format_i18n( $non_rendered_count ) |
| 738 | ), ENT_QUOTES, get_bloginfo( 'charset' ) ); |
| 739 | } |
| 740 | |
723 | 741 | $settings = array( |
724 | 742 | 'registeredSidebars' => array_values( $wp_registered_sidebars ), |
725 | 743 | 'registeredWidgets' => $wp_registered_widgets, |
… |
… |
final class WP_Customize_Widgets { |
733 | 751 | 'widgetMovedUp' => __( 'Widget moved up' ), |
734 | 752 | 'widgetMovedDown' => __( 'Widget moved down' ), |
735 | 753 | 'navigatePreview' => __( 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.' ), |
736 | | 'someAreasShown' => wp_array_slice_assoc( |
737 | | /* translators: placeholder is the number of other widget areas registered */ |
738 | | _n_noop( |
739 | | 'Your theme has %d other widget area, but this particular page doesn\'t display it.', |
740 | | 'Your theme has %d other widget areas, but this particular page doesn\'t display them.' |
741 | | ), |
742 | | array( 'singular', 'plural' ) |
743 | | ), |
744 | | 'noAreasShown' => wp_array_slice_assoc( |
| 754 | 'someAreasShown' => $some_non_rendered_areas_messages, |
| 755 | 'noAreasShown' => html_entity_decode( sprintf( |
745 | 756 | /* translators: placeholder is the total number of widget areas registered */ |
746 | | _n_noop( |
747 | | 'Your theme has %d widget area, but this particular page doesn\'t display it.', |
748 | | 'Your theme has %d widget areas, but this particular page doesn\'t display them.' |
| 757 | _n( |
| 758 | 'Your theme has %s widget area, but this particular page doesn’t display it.', |
| 759 | 'Your theme has %s widget areas, but this particular page doesn’t display them.', |
| 760 | $registered_sidebar_count |
749 | 761 | ), |
750 | | array( 'singular', 'plural' ) |
751 | | ), |
| 762 | number_format_i18n( $registered_sidebar_count ) |
| 763 | ), ENT_QUOTES, get_bloginfo( 'charset' ) ), |
752 | 764 | 'reorderModeOn' => __( 'Reorder mode enabled' ), |
753 | 765 | 'reorderModeOff' => __( 'Reorder mode closed' ), |
754 | 766 | 'reorderLabelOn' => esc_attr__( 'Reorder widgets' ), |
diff --git tests/qunit/fixtures/customize-widgets.js tests/qunit/fixtures/customize-widgets.js
index 14d43fb872..cee4c6db13 100644
|
|
window._wpCustomizeWidgetsSettings = { |
48 | 48 | 'l10n': { |
49 | 49 | 'error': 'An error has occurred. Please reload the page and try again.', |
50 | 50 | 'navigatePreview': 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.', |
51 | | 'noAreasShown': { |
52 | | 'plural': 'Your theme has %d widget areas, but this particular page doesn\'t display them.', |
53 | | 'singular': 'Your theme has %d widget area, but this particular page doesn\'t display it.' |
54 | | }, |
| 51 | 'noAreasShown': 'Your theme has 3 widget areas, but this particular page doesn\u2019t display them.', |
55 | 52 | 'noWidgetsFound': 'No widgets found.', |
56 | 53 | 'removeBtnLabel': 'Remove', |
57 | 54 | 'removeBtnTooltip': 'Trash widget by moving it to the inactive widgets sidebar.', |
… |
… |
window._wpCustomizeWidgetsSettings = { |
61 | 58 | 'saveBtnLabel': 'Apply', |
62 | 59 | 'saveBtnTooltip': 'Save and preview changes before publishing them.', |
63 | 60 | 'someAreasShown': { |
64 | | 'plural': 'Your theme has %d other widget areas, but this particular page doesn\'t display them.', |
65 | | 'singular': 'Your theme has %d other widget area, but this particular page doesn\'t display it.' |
| 61 | '1': 'Your theme has 1 other widget area, but this particular page doesn\u2019t display it.', |
| 62 | '2': 'Your theme has 2 other widget areas, but this particular page doesn\u2019t display them.' |
66 | 63 | }, |
67 | 64 | 'widgetMovedDown': 'Widget moved down', |
68 | 65 | 'widgetMovedUp': 'Widget moved up', |