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. Built from https://develop.svn.wordpress.org/trunk@57654 git-svn-id: http://core.svn.wordpress.org/trunk@57155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
378e9abb73
commit
b70ebbddf9
|
@ -353,6 +353,21 @@ window.setPostThumbnailL10n = window.setPostThumbnailL10n || {
|
|||
|
||||
window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
|
||||
|
||||
/**
|
||||
* Removed in 6.5.0, needed for back-compatibility.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @deprecated 6.5.0
|
||||
*/
|
||||
window.uiAutocompleteL10n = window.uiAutocompleteL10n || {
|
||||
noResults: '',
|
||||
oneResult: '',
|
||||
manyResults: '',
|
||||
itemSelected: ''
|
||||
};
|
||||
|
||||
window.uiAutocompleteL10n = deprecateL10nObject( 'uiAutocompleteL10n', window.uiAutocompleteL10n, '6.5.0' );
|
||||
|
||||
/**
|
||||
* Removed in 3.3.0, needed for back-compatibility.
|
||||
*
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,12 +4,11 @@
|
|||
* @output wp-admin/js/tags-suggest.js
|
||||
*/
|
||||
( function( $ ) {
|
||||
if ( typeof window.uiAutocompleteL10n === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tempID = 0;
|
||||
var separator = wp.i18n._x( ',', 'tag delimiter' ) || ',';
|
||||
var __ = wp.i18n.__,
|
||||
_n = wp.i18n._n,
|
||||
sprintf = wp.i18n.sprintf;
|
||||
|
||||
function split( val ) {
|
||||
return val.split( new RegExp( separator + '\\s*' ) );
|
||||
|
@ -139,13 +138,17 @@
|
|||
collision: 'none'
|
||||
},
|
||||
messages: {
|
||||
noResults: window.uiAutocompleteL10n.noResults,
|
||||
noResults: __( 'No results found.' ),
|
||||
results: function( number ) {
|
||||
if ( number > 1 ) {
|
||||
return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
|
||||
}
|
||||
|
||||
return window.uiAutocompleteL10n.oneResult;
|
||||
return sprintf(
|
||||
/* translators: %d: Number of search results found. */
|
||||
_n(
|
||||
'%d result found. Use up and down arrow keys to navigate.',
|
||||
'%d results found. Use up and down arrow keys to navigate.',
|
||||
number
|
||||
),
|
||||
number
|
||||
);
|
||||
}
|
||||
}
|
||||
}, options );
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
/*! This file is auto-generated */
|
||||
!function(u){var s,a;function l(e){return e.split(new RegExp(a+"\\s*"))}void 0!==window.uiAutocompleteL10n&&(s=0,a=wp.i18n._x(",","tag delimiter")||",",u.fn.wpTagsSuggest=function(e){var i,o,n,r=u(this);return r.length&&(n=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=u.extend({source:function(e,a){var t;o===e.term?a(i):(t=l(e.term).pop(),u.get(window.ajaxurl,{action:"ajax-tag-search",tax:n,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var n=++s;o.push({id:n,name:e[t]})}a(i=o)}else a(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=l(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(a+" ")),u.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):u.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(u(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:window.uiAutocompleteL10n.noResults,results:function(e){return 1<e?window.uiAutocompleteL10n.manyResults.replace("%d",e):window.uiAutocompleteL10n.oneResult}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return u('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){l(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){u(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this})}(jQuery);
|
||||
!function(s){var u=0,n=wp.i18n._x(",","tag delimiter")||",",t=wp.i18n.__,d=wp.i18n._n,l=wp.i18n.sprintf;function p(e){return e.split(new RegExp(n+"\\s*"))}s.fn.wpTagsSuggest=function(e){var i,o,a,r=s(this);return r.length&&(a=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=s.extend({source:function(e,n){var t;o===e.term?n(i):(t=p(e.term).pop(),s.get(window.ajaxurl,{action:"ajax-tag-search",tax:a,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var a=++u;o.push({id:a,name:e[t]})}n(i=o)}else n(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=p(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(n+" ")),s.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):s.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(s(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:t("No results found."),results:function(e){return l(d("%d result found. Use up and down arrow keys to navigate.","%d results found. Use up and down arrow keys to navigate.",e),e)}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return s('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){p(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){s(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this}}(jQuery);
|
|
@ -98,6 +98,9 @@
|
|||
var urlRegex2 = /^https?:\/\/[^\/]+\.[^\/]+($|\/)/i;
|
||||
var speak = ( typeof window.wp !== 'undefined' && window.wp.a11y && window.wp.a11y.speak ) ? window.wp.a11y.speak : function() {};
|
||||
var hasLinkError = false;
|
||||
var __ = window.wp.i18n.__;
|
||||
var _n = window.wp.i18n._n;
|
||||
var sprintf = window.wp.i18n.sprintf;
|
||||
|
||||
function getSelectedLink() {
|
||||
var href, html,
|
||||
|
@ -457,15 +460,17 @@
|
|||
my: 'left top+2'
|
||||
},
|
||||
messages: {
|
||||
noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',
|
||||
noResults: __( 'No results found.' ) ,
|
||||
results: function( number ) {
|
||||
if ( typeof window.uiAutocompleteL10n !== 'undefined' ) {
|
||||
if ( number > 1 ) {
|
||||
return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
|
||||
}
|
||||
|
||||
return window.uiAutocompleteL10n.oneResult;
|
||||
}
|
||||
return sprintf(
|
||||
/* translators: %d: Number of search results found. */
|
||||
_n(
|
||||
'%d result found. Use up and down arrow keys to navigate.',
|
||||
'%d results found. Use up and down arrow keys to navigate.',
|
||||
number
|
||||
),
|
||||
number
|
||||
);
|
||||
}
|
||||
}
|
||||
} ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -932,20 +932,6 @@ function wp_default_scripts( $scripts ) {
|
|||
$scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
|
||||
$scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
|
||||
|
||||
// Strings for 'jquery-ui-autocomplete' live region messages.
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
'jquery-ui-autocomplete',
|
||||
'uiAutocompleteL10n',
|
||||
array(
|
||||
'noResults' => __( 'No results found.' ),
|
||||
/* translators: Number of results found when using jQuery UI Autocomplete. */
|
||||
'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
|
||||
/* translators: %d: Number of results found when using jQuery UI Autocomplete. */
|
||||
'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
|
||||
'itemSelected' => __( 'Item selected.' ),
|
||||
)
|
||||
);
|
||||
|
||||
// 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' ), '4.3.0', 1 );
|
||||
|
||||
|
@ -1247,7 +1233,8 @@ function wp_default_scripts( $scripts ) {
|
|||
|
||||
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array( 'hoverintent-js' ), false, 1 );
|
||||
|
||||
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
|
||||
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'common', 'jquery', 'wp-a11y', 'wp-i18n' ), false, 1 );
|
||||
$scripts->set_translations( 'wplink' );
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
'wplink',
|
||||
'wpLinkL10n',
|
||||
|
@ -1425,7 +1412,7 @@ function wp_default_scripts( $scripts ) {
|
|||
$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
|
||||
$scripts->set_translations( 'tags-box' );
|
||||
|
||||
$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
|
||||
$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'common', 'jquery-ui-autocomplete', 'wp-a11y', 'wp-i18n' ), false, 1 );
|
||||
$scripts->set_translations( 'tags-suggest' );
|
||||
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ), false, 1 );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-beta1-57653';
|
||||
$wp_version = '6.5-beta1-57654';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue