From acba26b02540fa675dae8c71f7ddc26cb31467bc Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 17 Dec 2021 16:00:32 +0530 Subject: [PATCH] fix(Translations): Search suggestions for lists, reports etc (backport #15305) (#15346) Co-authored-by: Lev Vereshchagin Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> --- .../js/frappe/ui/toolbar/search_utils.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frappe/public/js/frappe/ui/toolbar/search_utils.js b/frappe/public/js/frappe/ui/toolbar/search_utils.js index fdc2efefde..9700276568 100644 --- a/frappe/public/js/frappe/ui/toolbar/search_utils.js +++ b/frappe/public/js/frappe/ui/toolbar/search_utils.js @@ -63,10 +63,11 @@ frappe.search.utils = { } } else if (['List', 'Tree', 'Workspaces', 'query-report'].includes(match[1][0]) && (match[1].length > 1)) { var type = match[1][0], label = type; - if(type==='Workspaces') label = 'Workspace'; - else if(type==='query-report' || match[1][2] ==='Report') label = 'Report'; - out.label = __(match[1][1]).bold() + " " + __(label); - out.value = __(match[1][1]) + " " + __(label); + if (type==='Workspaces') label = 'Workspace'; + else if (type==='query-report' || match[1][2] ==='Report') label = 'Report'; + out.label = __(`{0} ${label}`, [__(match[1][1]).bold()]); + out.value = __(`{0} ${label}`, [__(match[1][1])]); + } else if (match[0]) { out.label = match[0].bold(); out.value = match[0]; @@ -155,13 +156,17 @@ frappe.search.utils = { // check to skip extra list in the text // eg. Price List List should be only Price List let skip_list = type === 'List' && target.endsWith('List'); - let label = me.bolden_match_part(__(target), keywords); - label += skip_list ? '' : ` ${__(type)}`; + let label_without_type = me.bolden_match_part(__(target), keywords); + if (skip_list) { + var label = label_without_type; + } else { + label = __(`{0} ${skip_list ? '' : type}`, [label_without_type]); + } return { type: type, label: label, - value: __(target + " " + type), + value: __(`{0} ${type}`, [target]), index: level + order, match: target, route: route,