I18N: Fix passing singular/plural strings to JS.
This is a temporary solution while waiting for full I18N support in JS. Props ocean90, dd32, westonruter, Mirucon for testing. Amends [41376], [41721], [41389], See #20491. Fixes #42510 for trunk. Built from https://develop.svn.wordpress.org/trunk@42163 git-svn-id: http://core.svn.wordpress.org/trunk@41994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -175,10 +175,11 @@ class WP_Widget_Custom_HTML extends WP_Widget {
|
||||
wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.init( %s );', wp_json_encode( $settings ) ), 'after' );
|
||||
|
||||
$l10n = array(
|
||||
'errorNotice' => wp_array_slice_assoc(
|
||||
'errorNotice' => array(
|
||||
/* translators: %d: error count */
|
||||
_n_noop( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.' ),
|
||||
array( 'singular', 'plural' )
|
||||
'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),
|
||||
/* translators: %d: error count */
|
||||
'plural' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
|
||||
),
|
||||
);
|
||||
wp_add_inline_script( 'custom-html-widgets', sprintf( 'jQuery.extend( wp.customHtmlWidgets.l10n, %s );', wp_json_encode( $l10n ) ), 'after' );
|
||||
|
||||
Reference in New Issue
Block a user