-
Notifications
You must be signed in to change notification settings - Fork 10.4k
fix: added German translations for form validation messages #22367
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
base: main
Are you sure you want to change the base?
Conversation
@Anshumancanrock is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
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.
cubic reviewed 3 files and found no issues. Review PR in cubic.dev.
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (07/09/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add community label" took an action on this PR • (07/09/25)1 label was added to this PR based on Keith Williams's automation. |
@Anshumancanrock Can you please provide a loom video confirming the German translation ? |
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.
Pls share the evidence of the fix
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.
@anikdhabal @kart1ka . Sorry for the delay in getting back. I’ve made the requested changes now and also added a video showing that the German translation issue is fixed. Let me know if there’s anything else I should update. Really appreciate your time ! |
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.
cubic reviewed 5 files and found no issues. Review PR in cubic.dev.
@Anshumancanrock I don't see the video. |
Recording.2025-07-11.232123.mp4@kart1ka Hey Sir, I’ve fixed the type check issue and made sure the video is showing properly now. Let me know if anything else needs to be updated ! |
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.
Left a comment
4caac1b
WalkthroughAdds pluralized English and German translation keys for minimum/maximum character messages and updates form-booking validation code to accept an optional translateFn. translateFn is threaded through preprocessing and schema validation so validation messages are generated via the provided translation function and can receive parameters (e.g., count). Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes were found. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type 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: 2
🧹 Nitpick comments (1)
packages/features/bookings/Booker/components/hooks/useBookingForm.ts (1)
45-56
: Consider memoisingbookingFormSchema
getBookingResponsesSchema
(plus Zod object creation) runs on every render.
With larger schemas this is expensive and avoidable because the inputs (event.bookingFields
,rescheduleUid
,t
) change rarely.- const bookingFormSchema = z - .object({ - responses: event - ? getBookingResponsesSchema({ - bookingFields: event.bookingFields, - view: rescheduleUid ? "reschedule" : "booking", - translateFn: (key: string, options?: any) => String(t(key, options)), - }) - : // Fallback until event is loaded. - z.object({}), - }) - .passthrough(); + const bookingFormSchema = useMemo(() => { + return z + .object({ + responses: event + ? getBookingResponsesSchema({ + bookingFields: event.bookingFields, + view: rescheduleUid ? "reschedule" : "booking", + translateFn: (key: string, options?: Record<string, unknown>) => + t(key, options ?? {}), + }) + : z.object({}), // Fallback until event is loaded. + }) + .passthrough(); + }, [event, rescheduleUid, t]);This eliminates redundant work while keeping behaviour identical.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/web/public/static/locales/de/common.json
(1 hunks)apps/web/public/static/locales/en/common.json
(1 hunks)packages/features/bookings/Booker/components/hooks/useBookingForm.ts
(1 hunks)packages/features/bookings/lib/getBookingResponsesSchema.ts
(4 hunks)packages/features/form-builder/schema.ts
(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bandhan-majumder
PR: calcom/cal.com#22359
File: packages/lib/server/locales/en/common.json:1336-1339
Timestamp: 2025-07-14T16:31:45.201Z
Learning: When making localization changes for new features, it's often safer to add new strings rather than modify existing ones to avoid breaking existing functionality that depends on the original strings. This approach allows for feature-specific customization while maintaining backward compatibility.
apps/web/public/static/locales/de/common.json (1)
undefined
<retrieved_learning>
Learnt from: bandhan-majumder
PR: #22359
File: packages/lib/server/locales/en/common.json:1336-1339
Timestamp: 2025-07-14T16:31:45.201Z
Learning: When making localization changes for new features, it's often safer to add new strings rather than modify existing ones to avoid breaking existing functionality that depends on the original strings. This approach allows for feature-specific customization while maintaining backward compatibility.
</retrieved_learning>
apps/web/public/static/locales/en/common.json (1)
undefined
<retrieved_learning>
Learnt from: bandhan-majumder
PR: #22359
File: packages/lib/server/locales/en/common.json:1336-1339
Timestamp: 2025-07-14T16:31:45.201Z
Learning: When making localization changes for new features, it's often safer to add new strings rather than modify existing ones to avoid breaking existing functionality that depends on the original strings. This approach allows for feature-specific customization while maintaining backward compatibility.
</retrieved_learning>
🧬 Code Graph Analysis (1)
packages/features/bookings/lib/getBookingResponsesSchema.ts (2)
packages/features/calendars/weeklyview/types/state.ts (1)
View
(6-6)packages/prisma/zod-utils.ts (1)
bookingResponses
(155-178)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Security Check
🔇 Additional comments (6)
apps/web/public/static/locales/de/common.json (1)
13-14
: German placeholders look correct and follow existing pattern.The newly added keys use
{{count}}
consistently, matching the surrounding pluralised strings ("{{count}} Tag"
etc.), and punctuation/casing aligns with the adjacent “Min.” / “Max.” abbreviations. No issues spotted.packages/features/form-builder/schema.ts (2)
296-296
: LGTM: Enhanced translation function signatureThe updated signature
(key: string, options?: any) => string
properly supports parameterized translations, enabling dynamic value insertion for localized messages.
383-395
: LGTM: Improved localization for character validationThe changes correctly replace hardcoded English messages with translation keys (
max_characters_allowed
andmin_characters_required
) and pass character counts as parameters. This enables proper German localization with dynamic value insertion.packages/features/bookings/lib/getBookingResponsesSchema.ts (3)
12-13
: LGTM: Well-defined translation infrastructureThe
TranslationFunction
type and optionaltranslateFn
parameter inCommonParams
provide a clean foundation for internationalization while maintaining backward compatibility.
26-55
: LGTM: Consistent translation function propagationAll public functions correctly accept and pass through the
translateFn
parameter, ensuring the translation capability is available throughout the validation pipeline.
165-168
: LGTM: Proper translation integration with field taggingThe
m
function correctly applies translation when available while preserving the field name tagging mechanism ({fieldName}message
) for proper error contextualization.
packages/features/bookings/Booker/components/hooks/useBookingForm.ts
Outdated
Show resolved
Hide resolved
@kart1ka Hey Sir ! I have fixed the merge conflicts + added a fix to tackle the grammatical issue where we were showing "1 characters required" instead of "1 character required". Please let me know if you want any other changes. Appreciate your time ! |
@kart1ka Hey Sir ! Because of Rabbit AI suggestion i implemented "1 character" case without even thinking that the "1 character" case would never actually be displayed to users because of required field message, hence we dont need to handle that case. So i reverted that change and now everything is working clean like before. Here is the ss of translation after these changes: Appreciate your time ! |
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.
LGTM
@anikdhabal Please review sir and let me know if you want any changes. Appreciate your time ! |
@Anshumancanrock It will be reviewed. It is going to take some time. |
This PR is being marked as stale due to inactivity. |
3a6cf92
to
c870845
Compare
@keithwillcode I've implemented the plural forms and updated both English and German locales exactly as suggested. Please take a look and let me know if you’d like me to make any other changes. |
@keithwillcode The "1 character" case will never show since required field validation runs first, but implemented the complete pattern to follow i18next best practices as per your suggestions. Here is the latest video after changes: gg.mp4Please take a look and let me know if you’d like me to make any other changes. |
@kart1ka @keithwillcode Pease review this pr sir . It's been open for a long time and I would appreciate your feedback when you have a moment. |
What does this PR do?
Key Changes:
Visual Demo (For contributors especially)
Image Demo:
Before (Issues):
After (Fixed):
Recording.2025-07-11.232123.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Environment Setup:
Test Cases:
German Translation Validation:
Expected Results:
Minimal Test Data:
Checklist
Summary by cubic
Added missing German translations for form validation messages so German users now see localized error text.