-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
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.
@anikdhabal Please review this. 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.
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
@Anshumancanrock Can you pls fix the merge conflicts? |
4caac1b
""" WalkthroughThis change adds new translation keys for character count validation messages in both English and German locale files. It updates schema validation logic to support parameterized, localized error messages by introducing a translation function throughout the booking and form schema layers, enabling dynamic insertion of values such as character counts. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes were found. Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 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 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: 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
"min_characters_required": "Min. {{count}} characters required", | ||
"max_characters_allowed": "Max. {{count}} characters allowed", |
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.
💡 Verification agent
❓ Verification inconclusive
Plural-sensitive ICU message would avoid “1 characters” grammatical glitch
Both new strings interpolate {{count}}
but don’t supply an ICU plural rule (one
, other
, …) as is done elsewhere in this file (day_one
, day_other
, minute_one
, …).
Currently, count = 1
will render “Min. 1 characters required”, which is grammatically off.
- "min_characters_required": "Min. {{count}} characters required",
- "max_characters_allowed": "Max. {{count}} characters allowed",
+ "min_characters_required_one": "Min. {{count}} character required",
+ "min_characters_required_other": "Min. {{count}} characters required",
+ "max_characters_allowed_one": "Max. {{count}} character allowed",
+ "max_characters_allowed_other": "Max. {{count}} characters allowed",
Then adjust the lookup in code to use the pluralised keys the same way existing day_*
, minute_*
etc. are handled.
This keeps localisation consistent and avoids runtime grammar issues.
Add plural forms for character count messages
To prevent “1 characters” from appearing, align with existing day_one
/day_other
ICU plural keys in our JSON and update code to rely on the i18next plural lookup:
• apps/web/public/static/locales/en/common.json
- "min_characters_required": "Min. {{count}} characters required",
+ "min_characters_required_one": "Min. {{count}} character required",
+ "min_characters_required_other":"Min. {{count}} characters required",
- "max_characters_allowed": "Max. {{count}} characters allowed",
+ "max_characters_allowed_one": "Max. {{count}} character allowed",
+ "max_characters_allowed_other": "Max. {{count}} characters allowed",
• In your components or hooks, change any calls like
t('min_characters_required', { count })
t('max_characters_allowed', { count })
so they pass count
and let i18next pick the _one
/_other
key automatically.
This keeps our localization consistent and grammatically correct.
🤖 Prompt for AI Agents
In apps/web/public/static/locales/en/common.json around lines 13 to 14, the keys
for character count messages lack plural forms, causing incorrect grammar like
"1 characters." Add plural keys following the ICU format, such as
"min_characters_required_one" and "min_characters_required_other," and similarly
for "max_characters_allowed." Then update all component or hook calls to pass
the count parameter to the translation function so i18next can automatically
select the correct plural form.
@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. |
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.