From 38cfdae6e9ec31fcfd8ed93b0f8cfc27d2895d2c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Dec 2019 01:13:14 +0000 Subject: [PATCH] I18N: Make the minimum input length to start searching posts in the "Insert/edit link" modal localizable. Props Toro_Unit, birgire, miyauchi, swissspidy, ocean90. Fixes #44662. git-svn-id: https://develop.svn.wordpress.org/trunk@46988 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/lib/link.js | 5 +++-- src/wp-includes/script-loader.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/lib/link.js b/src/js/_enqueues/lib/link.js index 7c8c4984c5..954d211131 100644 --- a/src/js/_enqueues/lib/link.js +++ b/src/js/_enqueues/lib/link.js @@ -507,9 +507,10 @@ searchInternalLinks: function() { var waiting, - search = inputs.search.val() || ''; + search = inputs.search.val() || '', + minInputLength = parseInt( wpLinkL10n.minInputLength, 10 ) || 3; - if ( search.length > 2 ) { + if ( search.length >= minInputLength ) { rivers.recent.hide(); rivers.search.show(); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 27e0c8e996..2dd48d5a66 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1504,6 +1504,8 @@ function wp_default_scripts( &$scripts ) { 'noMatchesFound' => __( 'No results found.' ), 'linkSelected' => __( 'Link selected.' ), 'linkInserted' => __( 'Link inserted.' ), + /* translators: Minimum input length in characters to start searching posts in the "Insert/edit link" modal. */ + 'minInputLength' => (int) _x( '3', 'minimum input length for searching post links' ), ) );