Skip to content

EspoCRM – Open Source CRM Application

Action title translation

Yurii7dc1019473c0
diff --git a/client/src/components/controls.ts b/client/src/components/controls.ts
index d23e1555e3..fb408f94d2 100644
--- a/client/src/components/controls.ts
+++ b/client/src/components/controls.ts
@@ -37,6 +37,7 @@ interface ButtonOptions {
className?: string | null;
scope?: string | null;
title?: string | null;
+ titleTranslation?: string | null;
label?: string | null;
labelTranslation?: string | null;
link?: string | null;
@@ -56,6 +57,7 @@ interface DropdownItemOptions {
className?: string | null;
scope?: string | null;
title?: string | null;
+ titleTranslation?: string | null;
label?: string | null;
labelTranslation?: string | null;
link?: string | null;
@@ -114,6 +116,10 @@ export class ButtonComponent {
attrs.title = this.options.title;
}
+ if (!this.options.title && this.options.titleTranslation) {
+ attrs.title = this.language.translatePath(this.options.titleTranslation);
+ }
+
const {content, props} = prepareItemContent(this.options, this.language);
const on: any = {};
@@ -176,6 +182,10 @@ export class DropdownItemComponent {
attrs.title = this.options.title;
}
+ if (!this.options.title && this.options.titleTranslation) {
+ attrs.title = this.language.translatePath(this.options.titleTranslation);
+ }
+
const {content, props} = prepareItemContent(this.options, this.language, true);
if (!this.options.link) {
diff --git a/client/src/views/modal.ts b/client/src/views/modal.ts
index 0ad0f409b4..2f1489aa1b 100644
--- a/client/src/views/modal.ts
+++ b/client/src/views/modal.ts
@@ -90,6 +90,12 @@ interface ActionItem {
* A title text.
*/
title?: string;
+ /**
+ * A title translation path.
+ *
+ * @since 10.0.0
+ */
+ titleTranslation?: string;
/**
* A style.
*/
@@ -495,6 +501,10 @@ class ModalView<S extends ViewSchema = ViewSchema> extends View<S> {
}
}
+ if (!o.title && o.titleTranslation) {
+ o.title = this.getLanguage().translatePath(o.titleTranslation);
+ }
+
if (o.iconHtml && !o.html) {
o.html = o.iconHtml + '<span>' + this.getHelper().escapeString(o.text as string) + '</span>';
} else if (o.iconClass && !o.html) {
diff --git a/client/src/views/record/detail.ts b/client/src/views/record/detail.ts
index c46d3fc09d..ed706234bf 100644
--- a/client/src/views/record/detail.ts
+++ b/client/src/views/record/detail.ts
@@ -93,6 +93,12 @@ export interface Button {
* A title (not translatable).
*/
title?: string;
+ /**
+ * A title translation path.
+ *
+ * @since 10.0.0
+ */
+ titleTranslation?: string;
/**
* Disabled.
*/
@@ -145,6 +151,12 @@ export interface DropdownItem {
* A title (not translatable).
*/
title?: string;
+ /**
+ * A title translation path.
+ *
+ * @since 10.0.0
+ */
+ titleTranslation?: string;
/**
* Disabled.
*/
diff --git a/client/src/views/record/detail/buttons.ts b/client/src/views/record/detail/buttons.ts
index 4be1ed14dc..cb774004b4 100644
--- a/client/src/views/record/detail/buttons.ts
+++ b/client/src/views/record/detail/buttons.ts
@@ -60,6 +60,7 @@ export default class DetailRecordButtonsView extends View<{
labelTranslation: it.labelTranslation,
style: it.style,
title: it.title,
+ titleTranslation: it.titleTranslation,
text: it.text,
className: data.buttonClassName,
hidden: it.hidden,
@@ -107,6 +108,7 @@ export default class DetailRecordButtonsView extends View<{
label: it.label,
labelTranslation: it.labelTranslation,
title: it.title,
+ titleTranslation: it.titleTranslation,
text: it.text,
className: data.actionClassName,
hidden: it.hidden,
diff --git a/schema/metadata/clientDefs.json b/schema/metadata/clientDefs.json
index 0b1121eb85..85c0317a96 100644
--- a/schema/metadata/clientDefs.json
+++ b/schema/metadata/clientDefs.json
@@ -929,6 +929,10 @@
"type": "string",
"description": "A label translation path. As of v10.0."
},
+ "titleTranslation": {
+ "type": "string",
+ "description": "A title translation path. As of v10.0."
+ },
"handler": {
"type": "string",
"description": "A handler class for the action."