mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Account for multiple headers in single translation file
This commit is contained in:
parent
d3b9e21bf0
commit
d3519e44d0
|
@ -85,18 +85,21 @@ function getTranslationPaths() {
|
||||||
function getHeadersAndTranslations(paths) {
|
function getHeadersAndTranslations(paths) {
|
||||||
return paths.reduce((acc, cur) => {
|
return paths.reduce((acc, cur) => {
|
||||||
const translation = require(cur.source);
|
const translation = require(cur.source);
|
||||||
const nodeType = Object.keys(translation).pop();
|
const nodeTypes = Object.keys(translation);
|
||||||
const { header } = translation[nodeType];
|
|
||||||
|
|
||||||
if (isValidHeader(header, ALLOWED_HEADER_KEYS)) {
|
for (const nodeType of nodeTypes) {
|
||||||
acc.headers[nodeType] = header;
|
const { header } = translation[nodeType];
|
||||||
|
|
||||||
|
if (isValidHeader(header, ALLOWED_HEADER_KEYS)) {
|
||||||
|
acc.headers[nodeType] = header;
|
||||||
|
}
|
||||||
|
|
||||||
|
acc.translations.push({
|
||||||
|
destinationPath: cur.destination,
|
||||||
|
content: translation,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.translations.push({
|
|
||||||
destinationPath: cur.destination,
|
|
||||||
content: translation,
|
|
||||||
});
|
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, { headers: {}, translations: [] });
|
}, { headers: {}, translations: [] });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
githubTrigger: {
|
||||||
|
header: {
|
||||||
|
displayName: '🇩🇪 GitHub Trigger',
|
||||||
|
description: '🇩🇪 Listen to GitHub events',
|
||||||
|
},
|
||||||
|
},
|
||||||
github: {
|
github: {
|
||||||
header: {
|
header: {
|
||||||
displayName: '🇩🇪 GitHub',
|
displayName: '🇩🇪 GitHub',
|
||||||
|
|
Loading…
Reference in a new issue