Skip to content

Commit

Permalink
⚡ i18n feedback refactorings (#2597)
Browse files Browse the repository at this point in the history
* ⚡ Create endpoint for node credential translation

* ⚡ Add API helper method in FE

* 🔨 Add creds JSON files to tsconfig

* ⚡ Refactor credentials loading

* ⚡ Refactor calls in CredentialConfig

* ✏️ Add dummy translations

* ⚡ Split translations per node

* 🔥 Remove deprecated method

* ⚡ Refactor nesting in collections

* 🚚 Rename topParameter methods for accuracy

* ✏️ Fill out GitHub dummy cred

* 🚚 Clarify naming for collection utils

* ✏️ Fill out dummy translation

* 🔥 Remove surplus colons

* 🔥 Remove logging

* ⚡ Restore missing space

* 🔥 Remove lingering colon

* ⚡ Add path to InputLabel calls

* ✏️ Fill out dummy translations

* 🐛 Fix multipleValuesButtonText logic

* ⚡ Add sample properties to be deleted

* ⚡ Render deeply nested params

* 📦 Update package-lock.json

* 🔥 remove logging

* ✏️ Add dummy value to Slack translation

* ✏️ Add placeholder to dummy translation

* ⚡ Fix placeholder rendering for button text

* 👕 Fix lint

* 🔥 Remove outdated comment

* 🐛 Pass in missing arg for placeholder

* ✏️ Fill out Slack translation

* ⚡ Add explanatory comment

* ✏️ Fill out dummy translation

* ✏️ Update documentation

* 🔥 Remove broken link

* ✏️ Add pending functionality

* ✏️ Fix indentation

* 🐛 Fix method call in CredentialEdit

* ⚡ Implement eventTriggerDescription

* 🐛 Fix table-json-binary radio buttons

* ✏️ Clarify usage of eventTriggerDescription

* 🔥 Remove unneeded arg

* 🐛 Fix display in CodeEdit and TextEdit

* 🔥 Remove logging

* ✏️ Add translation for test cred options

* ✏️ Add test for separate file in same dir

* ✏️ Add test for versioned node

* ✏️ Add test for node in grouped dir

* ✏️ Add minor clarifications

* ✏️ Add nested collection test

* ✏️ Add pending functionality

* ⚡ Generalize collections handling

* 🚚 Rename helper to remove redundancy

* 🚚 Improve naming in helpers

* ✏️ Improve helpers documentation

* ✏️ Improve i18n methods documentation

* 🚚 Make endpoint naming consistent

* ✏️ Add final newlines

* ✏️ Clean up JSON examples

* ⚡ Reuse i18n method

* ⚡ Improve utils readability

* ⚡ Return early if cred translation exists

* 🔥 Remove dummy translations
  • Loading branch information
ivov authored Jan 7, 2022
1 parent 6a2db6d commit 5fec563
Show file tree
Hide file tree
Showing 30 changed files with 907 additions and 621 deletions.
236 changes: 118 additions & 118 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 28 additions & 3 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ import { InternalHooksManager } from './InternalHooksManager';
import { TagEntity } from './databases/entities/TagEntity';
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
import { NameRequest } from './WorkflowHelpers';
import { getNodeTranslationPath } from './TranslationHelpers';
import { getCredentialTranslationPath, getNodeTranslationPath } from './TranslationHelpers';

require('body-parser-xml')(bodyParser);

Expand Down Expand Up @@ -1178,6 +1178,27 @@ class App {
),
);

this.app.get(
`/${this.restEndpoint}/credential-translation`,
ResponseHelper.send(
async (
req: express.Request & { query: { credentialType: string } },
res: express.Response,
): Promise<object | null> => {
const translationPath = getCredentialTranslationPath({
locale: this.frontendSettings.defaultLocale,
credentialType: req.query.credentialType,
});

try {
return require(translationPath);
} catch (error) {
return null;
}
},
),
);

// Returns node information based on node names and versions
this.app.post(
`/${this.restEndpoint}/node-types`,
Expand All @@ -1201,13 +1222,17 @@ class App {
nodeTypes: INodeTypeDescription[],
) {
const { description, sourcePath } = NodeTypes().getWithSourcePath(name, version);
const translationPath = await getNodeTranslationPath(sourcePath, defaultLocale);
const translationPath = await getNodeTranslationPath({
nodeSourcePath: sourcePath,
longNodeType: description.name,
locale: defaultLocale,
});

try {
const translation = await readFile(translationPath, 'utf8');
description.translation = JSON.parse(translation);
} catch (error) {
// ignore - no translation at expected translation path
// ignore - no translation exists at path
}

nodeTypes.push(description);
Expand Down
Loading

0 comments on commit 5fec563

Please sign in to comment.