-
Notifications
You must be signed in to change notification settings - Fork 317
fIx: side toolbar tab tooltip not reactive when changing locale #4213
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
fIx: side toolbar tab tooltip not reactive when changing locale #4213
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.
Hey - thank you for the PR!
So looking this over, it feels like updateSidebarText is a very internal function - it has no params and should only be called be e.g. a watcher. (edit: because workspaceStore
is a public API for extensions)
Instead, we should probably just make the sidebar text reactive.
If this is something you'd like to look into, please feel free! If not, no stress - we can look into it when time permits.
Thanks. Digged a bit, I suggest to follow the pattern in |
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.
PR Review: fix: side toolbar tab tooltip not reactive when changing locale (#4213)
Summary
- Files changed: 7
- Lines added/removed: +22/-22
- Review scope: all
Review Comments:
- [src/stores/workspace/sidebarTabStore.ts:31] - [SEVERITY: Medium]
Issue: The command label is now using the translation key instead of translated text
label: tab.title,
Impact: Commands in the command palette will show translation keys (e.g., "sideToolbar.workflows") instead of translated labels (e.g., "Workflows")
Suggestion: The command registration needs access to i18n to translate the title:import { useI18n } from 'vue-i18n' // Inside the registerSidebarTab function const { t } = useI18n() useCommandStore().registerCommand({ // ... label: t(tab.title), // ... })
Positive Observations:
- ✅ Elegant fix that properly makes tooltips reactive to locale changes
- ✅ Maintains backward compatibility for extensions using plain strings
- ✅ Clean separation of concerns
- ✅ Minimal code changes with maximum effect
Tests will re-run when new changes are made 👍 |
|
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.
Hi @hyq2015, apologies for the confusion in my previous comments.
I've tested your PR thoroughly:
- Changed language from English to Chinese and back
- All sidebar tooltips (Queue, Node Library, Model Library, Workflows) now properly translate and update when changing locales
- Theme toggle and settings icons also work correctly
Your fix successfully makes the sidebar tooltips reactive to locale changes. This was the issue - tooltips were stuck in English before your changes.
LGTM! Thanks for fixing this.
Let's just see if the automated tests pass and then fix any failures, then we can merge!
Just a heads up - the component tests for To fix the tests, you'll need to update const i18n = createI18n({
legacy: false,
locale: 'en',
messages: {
en: {}
}
})
// In mountSidebarIcon function, add i18n to plugins:
global: {
plugins: [PrimeVue, i18n],
// ... rest of config
} You can verify the tests locally with: npm run test:component -- src/components/sidebar/SidebarIcon.spec.ts |
@christian-byrne oh thanks for the good catch, I will be more careful next time! btw, I fixed the component test error. |
…i18n collection issues Fixes i18n collection script issues caused by PR #4213's change to use raw i18n keys in sidebar tab command labels. The collection script was generating incorrect entries in commands.json with i18n keys as values instead of translated text, causing the UI to display raw keys like "sideToolbar.queue" instead of "Queue". Solution: Use getter functions `() => t(key)` for command labels/tooltips instead of raw i18n keys. This maintains the reactive functionality from #4213 while providing translated strings to the collection script, preventing incorrect locale file generation.
In current comfyui, after I changed my locale from 中文 to English , I found the side toobar title/label not up to date, it seems the side toolbar button text is not a reactive value regarding the locale change
┆Issue is synchronized with this Notion page by Unito