From b698c6bd3f13af017c7f3c0113b8407269ba1e0d Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Tue, 8 Dec 2020 16:36:10 -0500 Subject: [PATCH] fix(editors): only translate button texts when enableTranslate is true --- packages/common/src/editors/__tests__/longTextEditor.spec.ts | 1 + packages/common/src/editors/longTextEditor.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/src/editors/__tests__/longTextEditor.spec.ts b/packages/common/src/editors/__tests__/longTextEditor.spec.ts index c6d587415..15be8a9fa 100644 --- a/packages/common/src/editors/__tests__/longTextEditor.spec.ts +++ b/packages/common/src/editors/__tests__/longTextEditor.spec.ts @@ -111,6 +111,7 @@ describe('LongTextEditor', () => { it('should initialize the editor', () => { gridOptionMock.translater = translateService; + gridOptionMock.enableTranslate = true; editor = new LongTextEditor(editorArguments); const editorCount = document.body.querySelectorAll('.slick-large-editor-text.editor-title textarea').length; const editorTextCounter = document.body.querySelectorAll('.slick-large-editor-text.editor-title .editor-footer .counter'); diff --git a/packages/common/src/editors/longTextEditor.ts b/packages/common/src/editors/longTextEditor.ts index 89a09d635..caab9f1cb 100644 --- a/packages/common/src/editors/longTextEditor.ts +++ b/packages/common/src/editors/longTextEditor.ts @@ -94,7 +94,7 @@ export class LongTextEditor implements Editor { init(): void { let cancelText = ''; let saveText = ''; - if (this._translater && this._translater.translate) { + if (this._translater && this._translater.translate && this.gridOptions.enableTranslate) { const translationPrefix = getTranslationPrefix(this.gridOptions); const cancelKey = this.editorOptions.buttonTexts?.cancelKey ?? `${translationPrefix}CANCEL`; const saveKey = this.editorOptions.buttonTexts?.saveKey ?? `${translationPrefix}SAVE`;