diff --git a/frappe/public/js/frappe/form/formatters.js b/frappe/public/js/frappe/form/formatters.js index 6da3227a48..dc1c7a5fe2 100644 --- a/frappe/public/js/frappe/form/formatters.js +++ b/frappe/public/js/frappe/form/formatters.js @@ -164,6 +164,7 @@ frappe.form.formatters = { return ``; }, + Link: function (value, docfield, options, doc) { var doctype = docfield._options || docfield.options; var original_value = value; @@ -178,7 +179,7 @@ frappe.form.formatters = { } if (options && (options.for_print || options.only_value)) { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } if (frappe.form.link_formatters[doctype]) { @@ -211,10 +212,10 @@ frappe.form.formatters = { a.innerText = __((options && options.label) || link_title || value); return a.outerHTML; } else { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } } else { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } }, Date: function (value) { @@ -407,6 +408,13 @@ frappe.form.formatters = { AttachImage: format_attachment_url, }; +function get_link_display_value(doctype, link_title, value) { + let translated_doctypes = frappe.boot?.translated_doctypes || []; + if (translated_doctypes.includes(doctype)) { + return __(link_title || value); + } + return link_title || value; +} function format_attachment_url(url) { return url ? `${url}` : ""; }