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.

git-svn-id: https://develop.svn.wordpress.org/trunk@36806 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2016-03-02 20:05:04 +00:00
parent ce773cbc6c
commit bc41261ba4
3 changed files with 32 additions and 0 deletions

View File

@ -365,6 +365,18 @@
minLength: 2,
position: {
my: 'left top+2'
},
messages: {
noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',
results: function( number ) {
if ( typeof window.uiAutocompleteL10n !== 'undefined' ) {
if ( number > 1 ) {
return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
}
return window.uiAutocompleteL10n.oneResult;
}
}
}
} ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
return $( '<li role="option" id="mce-wp-autocomplete-' + item.ID + '">' )

View File

@ -95,6 +95,18 @@ var wpLink;
minLength: 2,
position: {
my: 'left top+2'
},
messages: {
noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',
results: function( number ) {
if ( typeof window.uiAutocompleteL10n !== 'undefined' ) {
if ( number > 1 ) {
return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
}
return window.uiAutocompleteL10n.oneResult;
}
}
}
} ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
return $( '<li role="option" id="mce-wp-autocomplete-' + item.ID + '">' )

View File

@ -224,6 +224,14 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 );
// Strings for 'jquery-ui-autocomplete' live region messages
did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
'noResults' => __( 'No search results.' ),
/* translators: Number of results found when using jQuery UI Autocomplete */
'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
) );
// deprecated, not used in core, most functionality is included in jQuery 1.3
$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1 );