-
Notifications
You must be signed in to change notification settings - Fork 169
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
[i18n] Impl i18n context menu translation #2394
[i18n] Impl i18n context menu translation #2394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run npm run format
to format the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to convert this translation to a core extension right now, just to avoid introducing more complexity in app.ts
.
src/scripts/app.ts
Outdated
if (!values) return; | ||
// Convert {w.name} to input | ||
// Convert {w.name} to widget | ||
var reInput = /Convert (.*) to input/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer const
/let
over var
.
src/scripts/app.ts
Outdated
var twgt = st("graphCanvasMenu. to widget", " to widget"); | ||
for (var i = 0; i < values.length; i++) { | ||
var value = values[i]; | ||
// 这里对应 从 slot 拖拽弹出的菜单, 但翻译后 菜单不能正常工作 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove commented code.
src/scripts/app.ts
Outdated
function translateMenus(values, options) | ||
{ | ||
if (!values) return; | ||
// Convert {w.name} to input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove commented code.
src/scripts/app.ts
Outdated
const OriginalContextMenu = LiteGraph.ContextMenu; | ||
LiteGraph.ContextMenu = function (values, options) { | ||
if (options.hasOwnProperty("title")) { | ||
options.title = st(`nodeDefs.${normalizeI18nKey(options.title)}.display_name`, options.title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. For some nodes, this will be a more significant change, as their type / display name differ more than just by spaces.
I use the context menu as a quick shorcut to find the actual node type ID - I have seen some Discord users talk about it also.
I think this is a good change though - we should surface the backend node type in some other way.
This PR has enhanced the right mouse click context menu translation.
![image](https://private-user-images.githubusercontent.com/49889381/408853330-f68f0412-d97b-407b-bb26-93056d6f4046.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNzQwNzIsIm5iZiI6MTczOTA3Mzc3MiwicGF0aCI6Ii80OTg4OTM4MS80MDg4NTMzMzAtZjY4ZjA0MTItZDk3Yi00MDdiLWJiMjYtOTMwNTZkNmY0MDQ2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDA0MDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE2MDY0NDhjNTBhNTcyYmQ0MDcyZWM2NjEzMWU4MzIxMGY3ODY4MzAyMWJmNDgzOWFiN2E5Yzk4NmY2ZTc0NmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Br3BHILDbNBbzCyys8GsP0Rr7XJbzMY6pnRNzOpHLG0)
┆Issue is synchronized with this Notion page by Unito