Skip to content

refactor(web): remove useMixedTranslation, better resource loading#30630

Merged
hyoban merged 22 commits intomainfrom
refactor/remove-usemixedtranslation
Jan 7, 2026
Merged

refactor(web): remove useMixedTranslation, better resource loading#30630
hyoban merged 22 commits intomainfrom
refactor/remove-usemixedtranslation

Conversation

@hyoban
Copy link
Member

@hyoban hyoban commented Jan 6, 2026

This PR removes useMixedTranslation and locale prop drilling. And we have a better resource loading experience, no need to reload the page.
I know this is related to the marketplace. I will make it correct on both sides.

Fixes #30648

Fixes #30649

- Replace useMixedTranslation with useTranslation from #i18n - Remove locale prop from marketplace components - Simplify useTags and useCategories hooks by removing translation parameter - Components now use the global locale from context instead of prop drilling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 6, 2026 09:08
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 6, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hyoban, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the internationalization (i18n) implementation within the web application, particularly for marketplace components. The primary goal is to centralize and simplify how translations are handled by moving away from a custom useMixedTranslation hook and explicit locale prop drilling. By adopting the #i18n module and leveraging a global locale context, the changes result in cleaner code, reduced boilerplate, and improved maintainability across various UI elements that require translation.

Highlights

  • Migration to #i18n module: The custom useMixedTranslation hook has been removed and replaced with useTranslation from the centralized #i18n module across numerous components.
  • Elimination of locale prop drilling: The explicit passing of locale props to marketplace-related components has been removed, simplifying component interfaces.
  • Streamlined translation hooks: The useTags and useCategories hooks no longer require a translation function parameter, as they now internally leverage the global translation context.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hyoban hyoban marked this pull request as draft January 6, 2026 09:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the marketplace components to use the centralized #i18n module instead of the custom useMixedTranslation hook, eliminating prop drilling of the locale parameter throughout the component tree. Components now retrieve locale from the global i18n context rather than receiving it as a prop.

  • Removed the useMixedTranslation hook and replaced it with useTranslation from #i18n
  • Simplified useTags and useCategories hooks by removing the translation parameter
  • Eliminated locale prop drilling across 21 component files

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
web/app/components/plugins/marketplace/hooks.ts Removed useMixedTranslation hook that supported external locale injection
web/app/components/plugins/hooks.ts Simplified useTags and useCategories to remove translation parameter
web/app/components/plugins/marketplace/index.tsx Removed locale prop from Marketplace component interface
web/app/components/plugins/marketplace/list/*.tsx Updated list components to use useTranslation from #i18n and useLocale where needed
web/app/components/plugins/marketplace/search-box/*.tsx Removed locale prop from search components
web/app/components/plugins/marketplace/sort-dropdown/index.tsx Updated to use useTranslation from #i18n
web/app/components/plugins/marketplace/plugin-type-switch.tsx Removed locale prop and updated to use useTranslation
web/app/components/plugins/marketplace/empty/index.tsx Updated to use useTranslation from #i18n
web/app/components/plugins/card/index.tsx Updated to use useTranslation and removed locale prop
web/app/components/plugins/base/deprecation-notice.tsx Updated to use useTranslation from #i18n
web/app/components/plugins/plugin-item/index.tsx Updated useCategories call to remove translation parameter
web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx Removed locale prop from List component usage
web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx Removed locale prop from List component usage
web/app/(commonLayout)/plugins/page.tsx Removed locale prop from Marketplace component
web/app/components/tools/marketplace/index.tsx Removed locale prop forwarding

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request provides an excellent, large-scale refactoring by removing the useMixedTranslation hook and centralizing i18n logic with the new #i18n module. This change successfully eliminates locale prop drilling across numerous components and simplifies related hooks like useTags and useCategories. The implementation is consistent and clean, leading to a significant improvement in code maintainability. The changes look solid.

hyoban and others added 4 commits January 6, 2026 17:52
Update test files to remove locale prop and useMixedTranslation usage after the refactor to use #i18n module directly: - Remove locale prop from component renders in tests - Update mocks from useMixedTranslation to useTranslation from #i18n - Add useLocale mock where needed - Remove locale-specific test cases that are no longer applicable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add mock for react-i18next's getI18n to prevent test failure when modules that use i18n are imported at module load time. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hyoban hyoban marked this pull request as ready for review January 6, 2026 10:36
@hyoban hyoban marked this pull request as draft January 6, 2026 10:42
lyzno1
lyzno1 previously approved these changes Jan 6, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 6, 2026
@lyzno1 lyzno1 removed the lgtm This PR has been approved by a maintainer label Jan 6, 2026
@hyoban hyoban marked this pull request as ready for review January 6, 2026 10:59
@hyoban hyoban marked this pull request as draft January 6, 2026 11:10
@hyoban hyoban changed the title refactor(web): remove useMixedTranslation and use #i18n module refactor(web): remove useMixedTranslation, better resource loading Jan 6, 2026
@hyoban hyoban marked this pull request as ready for review January 6, 2026 11:36
@crazywoola
Copy link
Member

The PR should be linked to an issue.

@hyoban hyoban marked this pull request as draft January 6, 2026 12:36
@hyoban hyoban marked this pull request as ready for review January 6, 2026 12:37
@hyoban hyoban requested a review from zxhlyh as a code owner January 6, 2026 12:51
@hyoban hyoban marked this pull request as draft January 6, 2026 13:00
@hyoban hyoban marked this pull request as ready for review January 7, 2026 04:52
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 7, 2026
@hyoban hyoban merged commit e335cd0 into main Jan 7, 2026
14 checks passed
@hyoban hyoban deleted the refactor/remove-usemixedtranslation branch January 7, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

4 participants