Make WordPress Core

Changeset 42164


Ignore:
Timestamp:
11/13/2017 07:08:56 AM (7 years ago)
Author:
westonruter
Message:

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 4.9.

Location:
branches/4.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/script-loader.php

    r42042 r42164  
    477477        'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
    478478        'saveError' => __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ),
    479         'lintError' => wp_array_slice_assoc(
     479        'lintError' => array(
    480480            /* translators: %d: error count */
    481             _n_noop( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.' ),
    482             array( 'singular', 'plural' )
     481            'singular' => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 1 ),
     482            /* translators: %d: error count */
     483            'plural' => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    483484        ),
    484485    ) ) ) );
     
    581582        // Used for overriding the file types allowed in plupload.
    582583        'allowedFiles'       => __( 'Allowed Files' ),
    583         'customCssError'     => wp_array_slice_assoc(
     584        'customCssError'     => array(
    584585            /* translators: %d: error count */
    585             _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.' ),
    586             array( 'singular', 'plural' )
     586            '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 ),
     587            /* translators: %d: error count */
     588            '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.
    587589        ),
    588590        'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),
    589         'saveBlockedError' => wp_array_slice_assoc(
     591        'saveBlockedError' => array(
    590592            /* translators: %s: number of invalid settings */
    591             _n_noop( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.' ),
    592             array( 'singular', 'plural' )
     593            'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
     594            /* translators: %s: number of invalid settings */
     595            'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    593596        ),
    594597        'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
  • branches/4.9/src/wp-includes/widgets/class-wp-widget-custom-html.php

    r41640 r42164  
    176176
    177177        $l10n = array(
    178             'errorNotice' => wp_array_slice_assoc(
     178            'errorNotice' => array(
    179179                /* translators: %d: error count */
    180                 _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.' ),
    181                 array( 'singular', 'plural' )
     180                '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 ),
     181                /* translators: %d: error count */
     182                '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.
    182183            ),
    183184        );
Note: See TracChangeset for help on using the changeset viewer.