Skip to content

feat: i18n plugin support merge custom plugin config && add isResouecesReady state#7926

Merged
caohuilin merged 11 commits intomainfrom
chore/i18n-plugin
Nov 28, 2025
Merged

feat: i18n plugin support merge custom plugin config && add isResouecesReady state#7926
caohuilin merged 11 commits intomainfrom
chore/i18n-plugin

Conversation

@caohuilin
Copy link
Copy Markdown
Member

Summary

Related Links

Checklist

  • I have added changeset via pnpm run change.
  • I have updated the documentation.
  • I have added tests to cover my changes.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 26, 2025

⚠️ No Changeset found

Latest commit: 5b9c4cd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 26, 2025

Rsdoctor Bundle Diff Analysis

📁 bundle-diff

Path: benchmark/bundle-diff/dist/rsdoctor-data.json

📌 Baseline Commit: c9ea637f4b | PR: #7931

Metric Current Baseline Change
📊 Total Size 497.5 KB 497.5 KB 0 B (0.0%)
📄 JavaScript 487.6 KB 487.6 KB 0 B (0.0%)
🎨 CSS 1.2 KB 1.2 KB 0 B (0.0%)
🌐 HTML 5.9 KB 5.9 KB 0 B (0.0%)
📁 Other Assets 2.8 KB 2.8 KB 0 B (0.0%)

📦 Download Diff Report: bundle-diff Bundle Diff

Generated by Rsdoctor GitHub Action

@caohuilin caohuilin changed the title feat: i18n plugin support merge custom plugin config && op wrapRoot feat: i18n plugin support merge custom plugin config && add isResouecesReady state Nov 27, 2025
@caohuilin caohuilin requested a review from Copilot November 28, 2025 00:45
Copy link
Copy Markdown
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 adds support for merging custom plugin configurations and introduces an isResourcesReady state to track translation resource loading. Additionally, it implements chained backend functionality, allowing the simultaneous use of HTTP/FS and SDK backends for progressive resource loading.

Key changes:

  • Added i18next-chained-backend dependency to enable multiple backend chaining
  • Introduced isResourcesReady property in useModernI18n to check if translation resources are loaded
  • Implemented config merging from runtime config with plugin options
  • Added new methods to SdkBackend for tracking loading state

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
pnpm-lock.yaml Added dependency for i18next-chained-backend@4.6.2
packages/runtime/plugin-i18n/package.json Added i18next-chained-backend and @modern-js/runtime-utils dependencies
packages/runtime/plugin-i18n/src/shared/type.ts Added cacheHitMode option and documentation for chained backend support
packages/runtime/plugin-i18n/src/runtime/index.tsx Implemented config merging, improved language change handling with refs, and added minimal i18n instance fallback
packages/runtime/plugin-i18n/src/runtime/i18n/instance.ts Added index signature to I18nInstance interface for flexibility
packages/runtime/plugin-i18n/src/runtime/i18n/backend/sdk-backend.ts Added methods to check loading state: isLoading(), getLoadingResources(), and hasLoadingResources()
packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.ts Implemented chained backend logic to use both HTTP and SDK backends together
packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.node.ts Implemented chained backend logic for Node.js environment (FS + SDK)
packages/runtime/plugin-i18n/src/runtime/i18n/backend/index.ts Added logic to detect and configure chained backend when both loadPath and SDK are present
packages/runtime/plugin-i18n/src/runtime/context.tsx Added isResourcesReady property and implementation to check if translation resources are loaded
packages/document/docs/zh/guides/advanced-features/international/*.mdx Added Chinese documentation for chained backend and isResourcesReady feature
packages/document/docs/en/guides/advanced-features/international/*.mdx Added English documentation for chained backend and isResourcesReady feature
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread packages/runtime/plugin-i18n/src/runtime/context.tsx Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/index.tsx Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/context.tsx
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.node.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/middleware.node.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/index.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/i18n/backend/sdk-backend.ts Outdated
Comment thread packages/runtime/plugin-i18n/src/runtime/index.tsx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 28, 2025

@caohuilin I've opened a new pull request, #7934, to work on those changes. Once the pull request is ready, I'll request review from you.

@caohuilin caohuilin merged commit a0de9a5 into main Nov 28, 2025
10 of 11 checks passed
@caohuilin caohuilin deleted the chore/i18n-plugin branch November 28, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants