-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Languages: add Belarusian language #4190
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA new Belarusian ( Changes
Poem
🪧 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 (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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: 2
🔭 Outside diff range comments (2)
packages/core/src/locales/be.ts (1)
1-133: 💡 Verification agent🧩 Analysis chain
Fix Prettier formatting issue
The pipeline is failing because of formatting issues. Let's run Prettier to fix it.
🏁 Script executed:
#!/bin/bash # Description: Check for specific formatting issues in the Belarusian locale file # Print the detected line endings in the file file packages/core/src/locales/be.ts | grep -o "line terminators" # Check indentation with spaces vs tabs grep -P "^\t" packages/core/src/locales/be.ts || echo "No tabs found at line beginnings" # Check for trailing whitespace grep -n " $" packages/core/src/locales/be.ts || echo "No trailing whitespace found"Length of output: 399
Run Prettier on packages/core/src/locales/be.ts to fix formatting
Hey, I didn’t spot any tabs or trailing spaces, so the CI failure is almost certainly due to Prettier style mismatches (quotes, commas, etc.). Could you run:pnpm prettier --write packages/core/src/locales/be.tsand commit the updated file? That should clear the formatting error.
🧰 Tools
🪛 GitHub Actions: test
[error] 31-108: Prettier formatting check failed. The file content differs from the expected formatting.
packages/docs/content/error-customization.mdx (1)
341-344: 🧹 Nitpick (assertive)Belarusian locale added to documentation
Great job adding the Belarusian locale to the documentation! The addition looks good, but consider maintaining alphabetical order for consistency.
- `az` — Azerbaijani +- `be` — Belarusian - `en` — English -- `be` — Belarusian
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
packages/core/src/locales.ts(1 hunks)packages/core/src/locales/be.ts(1 hunks)packages/docs/content/error-customization.mdx(5 hunks)
🧰 Additional context used
🪛 GitHub Actions: test
packages/core/src/locales/be.ts
[error] 31-108: Prettier formatting check failed. The file content differs from the expected formatting.
packages/core/src/locales.ts
[error] 2-4: Import statements are not sorted correctly. Please organize imports.
🔇 Additional comments (6)
packages/core/src/locales/be.ts (3)
1-40: Implementation looks solid! 👍Nice job implementing the Belarusian language support! The imports, the
Sizableobject, and the helper functions all look well-structured and similar to how other locale implementations handle these aspects.
42-73: Great handling of noun formats in BelarusianThe mapping of string formats to their Belarusian representations looks comprehensive. You've covered all the standard formats used in Zod.
75-124: Error mapping implementation looks goodYour error mapping function handles all the necessary error codes and provides appropriate Belarusian error messages. The messages are well-formed and should provide clear feedback to users.
packages/docs/content/error-customization.mdx (3)
11-13: Good formatting fixesThe formatting improvements to the blockquote and surrounding text look good. These small changes help maintain consistency in the documentation.
84-84: Whitespace cleanup - nice!Thanks for removing the trailing whitespace here. These small cleanups help maintain code quality.
241-272: More whitespace cleanup - great attention to detailGood job cleaning up the trailing whitespace in these lines as well. These small cleanups are easy to overlook but important for code quality.
| const _issue = issue as errors.$ZodStringFormatIssues; | ||
| if (_issue.format === "starts_with") | ||
| return `Няправільны радок: павінен пачынацца з "${issue}"`; | ||
| if (_issue.format === "ends_with") | ||
| return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`; | ||
| if (_issue.format === "includes") | ||
| return `Няправільны радок: павінен уключаць "${_issue.includes}"`; | ||
| if (_issue.format === "regex") | ||
| return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`; | ||
| return `Няправільны ${Nouns[_issue.format] ?? issue.format}`; | ||
| } |
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.
There's a small issue in the invalid_format case
In the case for "starts_with", you're passing the entire issue instead of the prefix property.
- if (_issue.format === "starts_with")
- return `Няправільны радок: павінен пачынацца з "${issue}"`;
+ if (_issue.format === "starts_with")
+ return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const _issue = issue as errors.$ZodStringFormatIssues; | |
| if (_issue.format === "starts_with") | |
| return `Няправільны радок: павінен пачынацца з "${issue}"`; | |
| if (_issue.format === "ends_with") | |
| return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`; | |
| if (_issue.format === "includes") | |
| return `Няправільны радок: павінен уключаць "${_issue.includes}"`; | |
| if (_issue.format === "regex") | |
| return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`; | |
| return `Няправільны ${Nouns[_issue.format] ?? issue.format}`; | |
| } | |
| const _issue = issue as errors.$ZodStringFormatIssues; | |
| if (_issue.format === "starts_with") | |
| return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`; | |
| if (_issue.format === "ends_with") | |
| return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`; | |
| if (_issue.format === "includes") | |
| return `Няправільны радок: павінен уключаць "${_issue.includes}"`; | |
| if (_issue.format === "regex") | |
| return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`; | |
| return `Няправільны ${Nouns[_issue.format] ?? issue.format}`; | |
| } |
| import az from "./locales/az.js"; | ||
| import en from "./locales/en.js"; | ||
| import es from "./locales/es.js"; | ||
| import be from "./locales/be.js"; | ||
|
|
||
| export { az, es, en }; | ||
| export { az, es, en, be }; |
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.
Fix import ordering
The pipeline is failing because the imports are not sorted correctly. Let's fix that:
import az from "./locales/az.js";
+import be from "./locales/be.js";
import en from "./locales/en.js";
import es from "./locales/es.js";
-import be from "./locales/be.js";
-export { az, es, en, be };
+export { az, be, en, es };This follows alphabetical ordering, which is generally preferred for imports.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import az from "./locales/az.js"; | |
| import en from "./locales/en.js"; | |
| import es from "./locales/es.js"; | |
| import be from "./locales/be.js"; | |
| export { az, es, en }; | |
| export { az, es, en, be }; | |
| import az from "./locales/az.js"; | |
| import be from "./locales/be.js"; | |
| import en from "./locales/en.js"; | |
| import es from "./locales/es.js"; | |
| export { az, be, en, es }; |
🧰 Tools
🪛 GitHub Actions: test
[error] 2-4: Import statements are not sorted correctly. Please organize imports.
|
Sorry, I didn’t notice this PR and created a duplicate one for Belarusian language #4199 |
| const Sizable: Record<string, { unit: string; verb: string }> = { | ||
| string: { unit: "сімвалаў", verb: "мець" }, | ||
| file: { unit: "байтаў", verb: "мець" }, | ||
| array: { unit: "элементаў", verb: "мець" }, | ||
| set: { unit: "элементаў", verb: "мець" }, | ||
| }; | ||
|
|
||
| function getSizing(origin: string): { unit: string; verb: string } | null { | ||
| return Sizable[origin] ?? null; | ||
| } |
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.

Summary by CodeRabbit