Skip to content

Commit

Permalink
fix generate-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed May 6, 2024
1 parent 65bcd85 commit 95cf047
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/bin/generate-translations
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ const {
promises: { writeFile },
} = require('fs');
const path = require('path');
const { packageDir } = require('./common');

const ALLOWED_HEADER_KEYS = ['displayName', 'description'];
const PURPLE_ANSI_COLOR_CODE = 35;

function getNodeTranslationPaths() {
const nodeDistPaths = require('./package.json').n8n.nodes;
const nodeDistPaths = require(`${packageDir}/package.json`).n8n.nodes;
const { N8N_DEFAULT_LOCALE: locale } = process.env;

return nodeDistPaths.reduce((acc, cur) => {
const nodeTranslationPath = path.join(
__dirname,
packageDir,
cur.split('/').slice(1, -1).join('/'),
'translations',
locale,
Expand Down Expand Up @@ -90,7 +91,7 @@ if (!locale || locale === 'en') {

const nodeTranslationPaths = getNodeTranslationPaths();
const headers = getHeaders(nodeTranslationPaths);
const headersDistPath = path.join(__dirname, 'dist', 'nodes', 'headers.js');
const headersDistPath = path.join(packageDir, 'dist', 'nodes', 'headers.js');

writeDistFile(headers, headersDistPath);

Expand Down

0 comments on commit 95cf047

Please sign in to comment.