Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: in editor-ui i18n dynamicRender isn't working as expected #8795

Open
TaylorHo opened this issue Mar 2, 2024 · 3 comments
Open

bug: in editor-ui i18n dynamicRender isn't working as expected #8795

TaylorHo opened this issue Mar 2, 2024 · 3 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@TaylorHo
Copy link

TaylorHo commented Mar 2, 2024

Bug Description

Working on some translations I've noticed that on editor-ui, the i18n main file (packages/editor-ui/src/plugins/i18n/index.ts) have a method called dynamicRender.

This method ideally should check if a key exists and, if it exists, should use the key translation. If the key doesn't exist, it uses a fallback.

Since the entire project is in English, it isn't easy to know that it's not working, since the key and its fallback have the same text, but it breaks when working in another language.

I've tried to use an existent key on the code, but it always uses the fallback.

To Reproduce

On the file (packages/editor-ui/src/plugins/i18n/index.ts), edit the method called dynamicRender.

Instead of return this.i18n.te(key) ? this.i18n.t(key).toString() : fallback ?? '';, edit it to make it use an existent key, like the code below:

private dynamicRender({ key, fallback }: { key: string; fallback?: string }) {
	const exampleKey: string = "codeNodeEditor.tabs.code";
	const exampleFallback: string = "Some Example Text";
	return this.i18n.te(exampleKey) ? this.i18n.t(exampleKey).toString() : exampleFallback ?? '';
}

Doing so you can notice that the value of exampleFallback is always used.

Also, if the key doesn't exist, the frontend UI breaks in errors, meaning that the this.i18n.te(key) part of the code is not working.

Expected behavior

Translations to work with dynamic keys.

Operating System

Tested on macOS, Debian 12, Ubuntu 22.04

n8n Version

1.29.1

Node.js Version

20

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Mar 5, 2024

Hey @TaylorHo,

Thanks for reporting this one, We don't currently fully support translations so I am not sure if this is expected because it still something in progress or if this is actually something we should fix now.

I have added this to the internal backlog ticket we have for i18n which is N8N-2650 and it it covers a number of issues that need to resolved.

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Mar 5, 2024
@TaylorHo
Copy link
Author

TaylorHo commented Mar 5, 2024

Okay, @Joffcom, I understand that translation support still needs more work. If I can help with anything, please let me know.

Can I explore this issue in search of a solution to have it already resolved when the translation solution is more mature?

@Joffcom
Copy link
Member

Joffcom commented Mar 6, 2024

Hey @TaylorHo,

I don't see why not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants