-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
feat: core components support simple locale switching #4273
Conversation
|
Warning Rate limit exceeded@anncwb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 41 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes introduce a new localization feature through the Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant LocaleManager as Locale Manager
participant Component as UI Component
App->>LocaleManager: setSimpleLocale(lang)
LocaleManager->>Component: update locale
Component->>LocaleManager: request translation for key
LocaleManager->>Component: return translated message
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts (1)
Potential Issues with Removing
cancelText
andconfirmText
The properties
cancelText
andconfirmText
are still used in various parts of the codebase, includingdrawer-api.ts
,modal.ts
, and their test files. Removing these properties fromdefaultState
might lead to issues if they are expected to be part of the state elsewhere.
- Files with Usage:
packages/@core/ui-kit/popup-ui/src/drawer/drawer-api.ts
packages/@core/ui-kit/popup-ui/src/modal/__tests__/modal-api.test.ts
packages/@core/ui-kit/popup-ui/src/modal/modal.ts
packages/@core/ui-kit/popup-ui/src/drawer/__tests__/drawer-api.test.ts
Please review these usages to ensure that the removal does not impact the functionality. Consider refactoring or updating the code where necessary.
Analysis chain
Line range hint
16-30
: LGTM! But verify the usage of removed properties.The removal of
cancelText
andconfirmText
properties simplifies the state management. However, ensure that these properties are not used elsewhere in the codebase.The code changes are approved.
Run the following script to verify the usage of
cancelText
andconfirmText
properties:Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `cancelText` and `confirmText` properties. # Test: Search for the usage of `cancelText` and `confirmText`. Expect: No occurrences. rg --type python -A 5 $'cancelText' rg --type python -A 5 $'confirmText'Length of output: 132
Script:
#!/bin/bash # Description: Verify the usage of `cancelText` and `confirmText` properties in TypeScript files. # Test: Search for the usage of `cancelText` and `confirmText`. Expect: No occurrences. rg --type ts -A 5 'cancelText' rg --type ts -A 5 'confirmText'Length of output: 7979
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (14)
- docs/src/en/guide/in-depth/theme.md (2 hunks)
- docs/src/guide/in-depth/theme.md (2 hunks)
- packages/@core/base/design/src/design-tokens/default/index.css (1 hunks)
- packages/@core/composables/src/index.ts (1 hunks)
- packages/@core/composables/src/use-simple-locale/README.md (1 hunks)
- packages/@core/composables/src/use-simple-locale/index.ts (1 hunks)
- packages/@core/composables/src/use-simple-locale/messages.ts (1 hunks)
- packages/@core/ui-kit/popup-ui/src/drawer/drawer-api.ts (1 hunks)
- packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue (3 hunks)
- packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts (1 hunks)
- packages/@core/ui-kit/popup-ui/src/modal/modal.vue (3 hunks)
- packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue (1 hunks)
- packages/locales/package.json (1 hunks)
- packages/locales/src/i18n.ts (3 hunks)
Files skipped from review due to trivial changes (3)
- docs/src/en/guide/in-depth/theme.md
- packages/@core/composables/src/use-simple-locale/README.md
- packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue
Additional comments not posted (19)
packages/@core/composables/src/index.ts (1)
5-5
: LGTM!The new export statement for
use-simple-locale
is correctly added and does not affect existing exports or logic.packages/@core/composables/src/use-simple-locale/messages.ts (3)
1-1
: LGTM!The type
Locale
is correctly defined and provides a clear representation of supported locales.
3-12
: LGTM!The constant
messages
is correctly defined and provides a clear mapping of messages for each locale.
14-14
: LGTM!The function
getMessages
is correctly defined and provides a clear way to retrieve messages for a given locale.packages/locales/package.json (1)
24-24
: LGTM!The new dependency
@vben-core/composables
is correctly added and aligns with the changes introduced in the other files.packages/@core/composables/src/use-simple-locale/index.ts (2)
1-5
: LGTM!The import statements are necessary and correctly implemented.
7-25
: LGTM!The function
useSimpleLocale
is correctly implemented and follows best practices.packages/locales/src/i18n.ts (2)
13-14
: LGTM!The import statement for
useSimpleLocale
is necessary and correctly implemented.
24-25
: LGTM!The function
loadLocaleMessages
is correctly updated to usesetSimpleLocale
.Also applies to: 82-82
packages/@core/ui-kit/popup-ui/src/drawer/drawer-api.ts (1)
31-36
: LGTM!The constructor modification allows for more flexible customization of the drawer component.
packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue (3)
6-10
: LGTM!The import statement for
useSimpleLocale
is correct and aligns with the objective of adding localization support.
41-41
: LGTM!The usage of
useSimpleLocale
composable is correct and enhances the localization functionality of the component.
172-180
: LGTM!The changes in the template for
cancelText
andconfirmText
slots are correct and improve the user experience by ensuring that the component can display text in the appropriate language.packages/@core/ui-kit/popup-ui/src/modal/modal.vue (3)
6-10
: LGTM!The import statement for
useSimpleLocale
is correct and aligns with the objective of adding localization support.
51-51
: LGTM!The usage of
useSimpleLocale
composable is correct and enhances the localization functionality of the component.
243-251
: LGTM!The changes in the template for
cancelText
andconfirmText
slots are correct and improve the user experience by ensuring that the component can display text in the appropriate language.packages/@core/base/design/src/design-tokens/default/index.css (1)
31-31
: LGTM! Verify the visual impact of the new primary theme color.The primary theme color is updated from
211 91% 39%
to231 98% 65%
. Ensure that the new color is consistent with the design guidelines and does not negatively impact the user experience.docs/src/guide/in-depth/theme.md (2)
56-56
: LGTM! Verify the visual impact of the new primary theme color.The primary theme color is updated from
211 91% 39%
to231 98% 65%
. Ensure that the new color is consistent with the design guidelines and does not negatively impact the user experience.
354-354
: LGTM! Verify the visual impact of the new primary theme color.The primary theme color is updated from
211 91% 39%
to231 98% 65%
. Ensure that the new color is consistent with the design guidelines and does not negatively impact the user experience.
Quality Gate passedIssues Measures |
* feat: core components support simple locale switching * fix: test error * fix: test error
Description
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit
New Features
useSimpleLocale
) for managing language settings and translations.Visual Updates
Documentation
use-simple-locale
module to assist developers with internationalization implementation.Bug Fixes