feat: i18n plugin support merge custom plugin config && add isResouecesReady state#7926
feat: i18n plugin support merge custom plugin config && add isResouecesReady state#7926
Conversation
|
Rsdoctor Bundle Diff Analysis📁 bundle-diffPath:
📦 Download Diff Report: bundle-diff Bundle Diff Generated by Rsdoctor GitHub Action |
9245fcc to
9e460d6
Compare
8586f1a to
3dc0ec8
Compare
There was a problem hiding this comment.
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-backenddependency to enable multiple backend chaining - Introduced
isResourcesReadyproperty inuseModernI18nto check if translation resources are loaded - Implemented config merging from runtime config with plugin options
- Added new methods to
SdkBackendfor 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.
|
@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. |
ab37ba4 to
f03555d
Compare
Summary
Related Links
Checklist
pnpm run change.