fix(Translations): Search suggestions for lists, reports etc (backport #15305) (#15346)

Co-authored-by: Lev Vereshchagin <mail@vrslev.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
mergify[bot] 2021-12-17 16:00:32 +05:30 committed by GitHub
parent e50d3ab6ac
commit acba26b025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,