Skip to content
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

feat: option to enforce language for bookingPage #18782

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

Conversation

vijayraghav-io
Copy link
Contributor

What does this PR do?

/claim #18710

https://www.loom.com/share/50790635a82f4767a4c1824167daf096?sid=acfe7870-5c4e-4c21-9997-724da66b7fde

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • - N/A- 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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Copy link

vercel bot commented Jan 21, 2025

@vijayraghav-io 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 Jan 21, 2025
@graphite-app graphite-app bot requested a review from a team January 21, 2025 13:59
@github-actions github-actions bot added booking-page area: booking page, public booking page, booker event types Created by Linear-GitHub Sync event-types area: event types, event-types i18n area: i18n, translations ui area: UI, frontend, button, form, input ✨ feature New feature or request 💎 Bounty A bounty on Algora.io ❗️ migrations contains migration files labels Jan 21, 2025
@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Jan 21, 2025
@dosubot dosubot bot added this to the v5.0 milestone Jan 21, 2025
Copy link

graphite-app bot commented Jan 21, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (01/21/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (01/21/25)

1 label was added to this PR based on Keith Williams's automation.

Comment on lines +10 to +15
try {
const bookerContext = useBookerI18n();
if (bookerContext.isLocaleReady) {
return bookerContext;
}
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

why catch {} ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as a fallback, if useLocale is called from non-booker components , it should use global locale or the atom context locale (as per prev or existing flow).

instead of having this entire snippet inside catch

if (context?.clientId) {
    return {
      i18n: context.i18n,
      t: context.t,
      isLocaleReady: true,
    } as unknown as {
      i18n: ReturnType<typeof useTranslation>["i18n"];
      t: ReturnType<typeof useTranslation>["t"];
      isLocaleReady: boolean;
    };
  }
  return {
    i18n,
    t,
    isLocaleReady,
  };

leaving catch {} looked legit to me, also its not required to log here for non-booker components as it's normal flow.
try {} is used here as useBookerI18n() throws error for non-booker components

Copy link
Contributor

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
booking-page area: booking page, public booking page, booker bookings area: bookings, availability, timezones, double booking 🙋 Bounty claim 💎 Bounty A bounty on Algora.io community Created by Linear-GitHub Sync event types Created by Linear-GitHub Sync event-types area: event types, event-types ✨ feature New feature or request i18n area: i18n, translations ❗️ migrations contains migration files ready-for-e2e ui area: UI, frontend, button, form, input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-5043] event-type: option to enforce a language for the booking page (default: visitors browser language)
2 participants