From 760ef5a32b35bd9f8dd46313aa5b385f72e76ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 5 May 2022 15:21:53 +0200 Subject: [PATCH] :pencil2: Add i18n to `reportUnsetCredential()` --- .../src/components/mixins/nodeHelpers.ts | 31 ++++++++++++------- .../src/plugins/i18n/locales/en.json | 1 + 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/editor-ui/src/components/mixins/nodeHelpers.ts b/packages/editor-ui/src/components/mixins/nodeHelpers.ts index d5f132bdc4..9d09389a2a 100644 --- a/packages/editor-ui/src/components/mixins/nodeHelpers.ts +++ b/packages/editor-ui/src/components/mixins/nodeHelpers.ts @@ -124,6 +124,23 @@ export const nodeHelpers = mixins( return false; }, + reportUnsetCredential(credentialType: ICredentialType) { + return { + credentials: { + [credentialType.name]: [ + this.$locale.baseText( + 'nodeHelpers.credentialsUnset', + { + interpolate: { + credentialType: credentialType.displayName, + }, + }, + ), + ], + }, + }; + }, + // Updates the execution issues. updateNodesExecutionIssues () { const nodes = this.$store.getters.allNodes; @@ -219,7 +236,7 @@ export const nodeHelpers = mixins( selectedCredsAreUnusable(node, genericAuthType) ) { const credential = this.getCredentialTypeByName(genericAuthType); - return reportUnsetCredential(credential); + return this.reportUnsetCredential(credential); } if ( @@ -232,7 +249,7 @@ export const nodeHelpers = mixins( if (selectedCredsDoNotExist(node, nodeCredentialType, stored)) { const credential = this.getCredentialTypeByName(nodeCredentialType); - return reportUnsetCredential(credential); + return this.reportUnsetCredential(credential); } } @@ -243,7 +260,7 @@ export const nodeHelpers = mixins( selectedCredsAreUnusable(node, nodeCredentialType) ) { const credential = this.getCredentialTypeByName(nodeCredentialType); - return reportUnsetCredential(credential); + return this.reportUnsetCredential(credential); } for (const credentialTypeDescription of nodeType!.credentials!) { @@ -469,14 +486,6 @@ function selectedCredsDoNotExist( return !storedCredsByType.find((c) => c.id === selectedCredsByType.id); } -function reportUnsetCredential(credentialType: ICredentialType) { - return { - credentials: { - [credentialType.name]: [`Credentials for "${credentialType.displayName}" are not set.`], - }, - }; -} - declare namespace HttpRequestNode { namespace V2 { type AuthParams = { diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 07d529d4c0..23f26d677a 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -387,6 +387,7 @@ "nodeErrorView.stack": "Stack", "nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed", "nodeErrorView.time": "Time", + "nodeHelpers.credentialsUnset": "Credentials for '{credentialType}' are not set.", "nodeSettings.alwaysOutputData.description": "If active, will output a single, empty item when the output would have been empty. Use to prevent the workflow finishing on this node.", "nodeSettings.alwaysOutputData.displayName": "Always Output Data", "nodeSettings.clickOnTheQuestionMarkIcon": "Click the '?' icon to open this node on n8n.io",