Skip to content

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

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
@dosubot dosubot bot added the 🐛 bug Something isn't working label Jul 12, 2025
cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Jul 12, 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.

@Anshumancanrock
Copy link
Author

@anikdhabal Please review this. Appreciate your time !

@kart1ka kart1ka marked this pull request as draft July 13, 2025 13:01
@Anshumancanrock Anshumancanrock marked this pull request as ready for review July 13, 2025 13:25
cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Jul 13, 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
kart1ka previously approved these changes Jul 13, 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

@kart1ka
Copy link
Contributor

kart1ka commented Jul 15, 2025

@Anshumancanrock Can you pls fix the merge conflicts?

Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

"""

Walkthrough

This 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

Files/Paths Change Summary
apps/web/public/static/locales/de/common.json, apps/web/public/static/locales/en/common.json Added "min_characters_required" and "max_characters_allowed" translation keys with placeholders for count.
packages/features/bookings/Booker/components/hooks/useBookingForm.ts Passed a translation function (translateFn) to booking response schema logic.
packages/features/bookings/lib/getBookingResponsesSchema.ts Refactored schema logic to accept and use a translation function for error messages; updated relevant function signatures/types.
packages/features/form-builder/schema.ts Updated error message construction to use parameterized translation keys and accept options (e.g., count) in the translation fn.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Add missing German translations for character count validation messages (#22358, CAL-6070)
Enable parameterized and localized error messages for min/max character validation (#22358, CAL-6070)
Update schema validation logic to utilize translation functions for dynamic messages (#22358, CAL-6070)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.

Poem

In fields of forms, a bunny hops,
With words in German, translation pops!
Min and max, the count is clear,
Now every message rabbits cheer.
Dynamic strings—oh, what delight,
Localization done just right!
🐇✨
"""

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 details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b15e6ae and 9d0ddb6.

📒 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
  • 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 src/utils.ts and explain its main purpose.
    • @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 comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

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

Comment on lines +13 to +14
"min_characters_required": "Min. {{count}} characters required",
"max_characters_allowed": "Max. {{count}} characters allowed",
Copy link
Contributor

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.

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

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
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
6 participants