Make WordPress Core

Changeset 36806


Ignore:
Timestamp:
03/02/2016 08:05:04 PM (11 years ago)
Author:
azaozz
Message:

TinyMCE, inline link:

  • Add uiAutocompleteL10n with translatable strings for use in UI Autocomplete live region.
  • Use the above strings in both the editor plugin and wplink.js.

See #33301.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js

    r36777 r36806  
    366366                                                position: {
    367367                                                        my: 'left top+2'
     368                                                },
     369                                                messages: {
     370                                                        noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',
     371                                                        results: function( number ) {
     372                                                                if ( typeof window.uiAutocompleteL10n !== 'undefined' ) {
     373                                                                        if ( number > 1 ) {
     374                                                                                return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
     375                                                                        }
     376
     377                                                                        return window.uiAutocompleteL10n.oneResult;
     378                                                                }
     379                                                        }
    368380                                                }
    369381                                        } ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
  • trunk/src/wp-includes/js/wplink.js

    r36777 r36806  
    9696                                position: {
    9797                                        my: 'left top+2'
     98                                },
     99                                messages: {
     100                                        noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',
     101                                        results: function( number ) {
     102                                                if ( typeof window.uiAutocompleteL10n !== 'undefined' ) {
     103                                                        if ( number > 1 ) {
     104                                                                return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
     105                                                        }
     106
     107                                                        return window.uiAutocompleteL10n.oneResult;
     108                                                }
     109                                        }
    98110                                }
    99111                        } ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
  • trunk/src/wp-includes/script-loader.php

    r36780 r36806  
    225225        $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 );
    226226
     227        // Strings for 'jquery-ui-autocomplete' live region messages
     228        did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
     229                        'noResults' => __( 'No search results.' ),
     230                        /* translators: Number of results found when using jQuery UI Autocomplete */
     231                        'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
     232                        'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
     233        ) );
     234
    227235        // deprecated, not used in core, most functionality is included in jQuery 1.3
    228236        $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1 );
Note: See TracChangeset for help on using the changeset viewer.