-
Notifications
You must be signed in to change notification settings - Fork 2
feat: 添加多语言支持(中/英) #45
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
Open
sunnylqm
wants to merge
2
commits into
main
Choose a base branch
from
feat/i18n
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,997
−1,050
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
For i18next/react-i18next pluralization, does the specialcountoption need to stay numeric instead of a formatted string?💡 Result:
Yes, the special count option must remain a numeric value (a JavaScript number) to function correctly for pluralization [1][2]. i18next uses the provided count value to determine which plural form (such as _one, _other, or language-specific forms) to select based on the rules for the active language [3][4]. Because the library relies on these numeric rules to perform calculations, passing a formatted string will prevent it from correctly identifying the appropriate translation key [2]. Key considerations include: 1. Numeric Requirement: The count must be a number [1][2]. If you need to display a formatted number (e.g., "1,000" or "1.000"), you should pass the raw numeric value to the count option for pluralization logic, and use i18next's interpolation formatting or a separate formatting library to handle the display string independently [3][5][4]. 2. Inference Limitations: In react-i18next, while the Trans component can automatically infer the count if it is present as {{count}} in the children, this inference also requires the value to be a JavaScript number [2]. String values will not be correctly inferred [2]. 3. Fallback Behavior: If a valid numeric count is not provided, i18next cannot determine the plural form and will fail to resolve the key correctly, often returning the raw key name instead of the translated string [3][4].
Citations:
Keep
countnumeric and format the display separatelycountmust stay a number for i18next plural selection;apps.length.toLocaleString()breaks that contract. The same applies to the check-count label below, which should use the active UI locale only for rendering.🤖 Prompt for AI Agents