Make WordPress Core


Ignore:
Timestamp:
02/18/2024 10:14:04 PM (11 months ago)
Author:
peterwilsoncc
Message:

Script Loader: Switch to JavaScript translations.

Update JavaScript files for tag suggestions and the TinyMCE link plugin to use client side translations. This allows for _n() to be used for strings requiring singular and plural versions in which the correct form is only known client side.

Props audrasjb, chaion07, costdev, hellofromtonya, johnbillion, marybaum, nicolefurlan, oglekler, rebasaurus, rsiddharth, sergeybiryukov, shaampk1, shahariaazam, swissspidy, tobifjellner.
Fixes #48244.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r57602 r57654  
    932932    $scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
    933933    $scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
    934 
    935     // Strings for 'jquery-ui-autocomplete' live region messages.
    936     did_action( 'init' ) && $scripts->localize(
    937         'jquery-ui-autocomplete',
    938         'uiAutocompleteL10n',
    939         array(
    940             'noResults'    => __( 'No results found.' ),
    941             /* translators: Number of results found when using jQuery UI Autocomplete. */
    942             'oneResult'    => __( '1 result found. Use up and down arrow keys to navigate.' ),
    943             /* translators: %d: Number of results found when using jQuery UI Autocomplete. */
    944             'manyResults'  => __( '%d results found. Use up and down arrow keys to navigate.' ),
    945             'itemSelected' => __( 'Item selected.' ),
    946         )
    947     );
    948934
    949935    // Deprecated, not used in core, most functionality is included in jQuery 1.3.
     
    12481234    $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array( 'hoverintent-js' ), false, 1 );
    12491235
    1250     $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
     1236    $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'common', 'jquery', 'wp-a11y', 'wp-i18n' ), false, 1 );
     1237    $scripts->set_translations( 'wplink' );
    12511238    did_action( 'init' ) && $scripts->localize(
    12521239        'wplink',
     
    14261413        $scripts->set_translations( 'tags-box' );
    14271414
    1428         $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
     1415        $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'common', 'jquery-ui-autocomplete', 'wp-a11y', 'wp-i18n' ), false, 1 );
    14291416        $scripts->set_translations( 'tags-suggest' );
    14301417
Note: See TracChangeset for help on using the changeset viewer.