Skip to content

Conversation

Anshumancanrock
Copy link

@Anshumancanrock Anshumancanrock commented Jul 9, 2025

What does this PR do?

Key Changes:

  • Fixes missing German localization for form validation messages

Visual Demo (For contributors especially)

Image Demo:

Before (Issues):

68747470733a2f2f75706c6f6164732e6c696e6561722e6170702f65383662663935372d643832662d343635652d623230352d3133353535396634623632332f63626263323830322d633262662d346663362d393462362d3666383662656435366161372f626132666137

  • German users saw "Min. 20 characters required" instead of localized text

After (Fixed):

Screenshot 2025-07-11 233252
Recording.2025-07-11.232123.mp4
  • German users see: "Min. 20 Zeichen erforderlich"

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. N/A - These are internal URL construction fixes that don't affect public API.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Environment Setup:

  • No special environment variables required
  • Standard Cal.com development setup

Test Cases:

German Translation Validation:

  • Set browser language to German
  • Create/edit an event type with form fields requiring min/max characters
  • Verify validation messages appear in German: "Min. 20 Zeichen erforderlich"

Expected Results:

  • German form validation messages display correctly

Minimal Test Data:

  • German locale enabled in browser/system

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Summary by cubic

Added missing German translations for form validation messages so German users now see localized error text.

  • Bug Fixes
    • Updated German locale with messages for minimum and maximum character validation.
    • Changed validation logic to use translation keys for both English and German.

@CLAassistant
Copy link

CLAassistant commented Jul 9, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

vercel bot commented Jul 9, 2025

@Anshumancanrock is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jul 9, 2025
@graphite-app graphite-app bot requested a review from a team July 9, 2025 22:18
@github-actions github-actions bot added i18n area: i18n, translations Public labels Jul 9, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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.

Copy link

graphite-app bot commented Jul 9, 2025

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.

@akashkinkarpandey
Copy link
Contributor

@Anshumancanrock Can you please provide a loom video confirming the German translation ?

Copy link
Contributor

@anikdhabal anikdhabal left a 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

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not seem to work

Image

@kart1ka kart1ka marked this pull request as draft July 11, 2025 05:15
@Anshumancanrock Anshumancanrock marked this pull request as ready for review July 11, 2025 18:07
@Anshumancanrock Anshumancanrock requested a review from a team as a code owner July 11, 2025 18:07
@Anshumancanrock
Copy link
Author

@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 !

cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Jul 11, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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.

@kart1ka
Copy link
Contributor

kart1ka commented Jul 11, 2025

@Anshumancanrock I don't see the video.
Also can you please make sure that all the necessary checks are passing? Type check seem to be failing.

@Anshumancanrock
Copy link
Author

Anshumancanrock commented Jul 11, 2025

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 !

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment

@Anshumancanrock Anshumancanrock marked this pull request as draft July 12, 2025 10:29
Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Walkthrough

Adds 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

Objective (issue#) Addressed Explanation
Add missing German translations for character count validation messages (#22358, CAL-6070)
Make min/max character validation messages parameterized (accept count) (#22358, CAL-6070)
Ensure schema validation surfaces localized messages via a translation function (#22358, CAL-6070)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c870845 and b107cc2.

📒 Files selected for processing (2)
  • apps/web/public/static/locales/de/common.json (1 hunks)
  • apps/web/public/static/locales/en/common.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/public/static/locales/en/common.json
  • apps/web/public/static/locales/de/common.json
⏰ 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)
  • GitHub Check: Install dependencies / Yarn install & cache
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 memoising bookingFormSchema

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

📥 Commits

Reviewing files that changed from the base of the PR and between 202d248 and 4caac1b.

📒 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 signature

The 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 validation

The changes correctly replace hardcoded English messages with translation keys (max_characters_allowed and min_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 infrastructure

The TranslationFunction type and optional translateFn parameter in CommonParams provide a clean foundation for internationalization while maintaining backward compatibility.


26-55: LGTM: Consistent translation function propagation

All 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 tagging

The m function correctly applies translation when available while preserving the field name tagging mechanism ({fieldName}message) for proper error contextualization.

@Anshumancanrock Anshumancanrock requested a review from kart1ka July 15, 2025 06:13
@Anshumancanrock
Copy link
Author

Anshumancanrock commented Jul 15, 2025

@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 !

@Anshumancanrock
Copy link
Author

Anshumancanrock commented Jul 15, 2025

@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:

Screenshot 2025-07-15 120921

Appreciate your time !

kart1ka
kart1ka previously approved these changes Jul 16, 2025
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anikdhabal anikdhabal added the Low priority Created by Linear-GitHub Sync label Jul 16, 2025
@Anshumancanrock
Copy link
Author

@anikdhabal Please review sir and let me know if you want any changes. Appreciate your time !

@kart1ka
Copy link
Contributor

kart1ka commented Jul 18, 2025

@Anshumancanrock It will be reviewed. It is going to take some time.

Copy link
Contributor

github-actions bot commented Aug 5, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Aug 5, 2025
@github-actions github-actions bot removed the Stale label Aug 9, 2025
@Anshumancanrock
Copy link
Author

@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.

@Anshumancanrock
Copy link
Author

@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.mp4

Please take a look and let me know if you’d like me to make any other changes.

@Anshumancanrock
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working community Created by Linear-GitHub Sync i18n area: i18n, translations Low priority Created by Linear-GitHub Sync Public
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing translation in German
7 participants