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

fix: [CAL-3880] remove i18n for all <Meta> or figure out how to SSR #15367

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

Conversation

martinsione
Copy link
Contributor

@martinsione martinsione commented Jun 7, 2024

What does this PR do?

Notes

I tried to keep it as isolated as possible (just affecting the components that have tag) but I think this "pattern" of defaulting to english when there is no content yet is worth adding it straight to the useLocale hook because right now google is indexing pages with the keys of i18n elements (If there is an agreement to this I'm happy to move this defaultValue over to the useLocale component. In terms of weight/size I think it's nothing to worry about as it's only 162 KB, for reference, the signup page takes 4.2MB and part of that is downloading the /en/common.json so if there is an agreement to make useLocale default to english we could potentially avoid fetching /en/common.json when locale = 'en' resulting in a net zero change in terms of bundle for english users (and minimal for other users).

Screenshot 2024-06-06 at 11 59 06 PM Screenshot 2024-06-06 at 11 54 13 PM
Screenshot 2024-06-06 at 11 54 53 PM

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 added a Docs issue here if this PR makes changes that would require a documentation change
  • (N/A) I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

  • You can test by disabling javascript and going to /video/no-meeting-found, right now you'll see "no_meeting_found | Cal.com" with this PR you'll see "No Meeting Found | Cal.com". You can try this on any other page that use <HeadSeo /> component.

Copy link

vercel bot commented Jun 7, 2024

@martinsione 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 Jun 7, 2024
@graphite-app graphite-app bot requested a review from a team June 7, 2024 03:01
Copy link
Contributor

github-actions bot commented Jun 7, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@github-actions github-actions bot added i18n area: i18n, translations Medium priority Created by Linear-GitHub Sync 💎 Bounty A bounty on Algora.io 🙋🏻‍♂️help wanted Help from the community is appreciated labels Jun 7, 2024
@dosubot dosubot bot added this to the v4.2 milestone Jun 7, 2024
@martinsione martinsione changed the title [CAL-3880] remove i18n for all <Meta> or figure out how to SSR fix: [CAL-3880] remove i18n for all <Meta> or figure out how to SSR Jun 7, 2024
Copy link

graphite-app bot commented Jun 7, 2024

Graphite Automations

"Add community label" took an action on this PR • (06/07/24)

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

"Add consumer team as reviewer" took an action on this PR • (06/07/24)

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


import type { AppImageProps, MeetingImageProps } from "@calcom/lib/OgImages";
import { constructAppImage, constructGenericImage, constructMeetingImage } from "@calcom/lib/OgImages";
import { APP_NAME, CAL_URL } from "@calcom/lib/constants";
import { buildCanonical, getSeoImage, seoConfig } from "@calcom/lib/next-seo.config";
import { truncateOnWord } from "@calcom/lib/text";

import text from "../../../../apps/web/public/static/locales/en/common.json";
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this cause the locales to be downloaded twice? one in the bundle and one in the next.js props?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a bit more context on the PR description but tldr yes it would however I think the size is negligible compared to the problems it solves. With RSC the story is a bit different because you can technically stream compute from the server so would allow you to stream translation from the server directly however I think that would be a far bigger effort. What I also suggested in the description is that if there is interest to adopt this pattern, what we can do is on the useLocale hook that is used everywhere add the english translations as default and when the locale of a user is english avoid fetching the translation file again so this would result on a net zero impact for english users and yes it would have a cost for other users but again, I think the benefits outweighs the costs. What you think @zomars?

Eg this is what people see when they search for "cal com sign up"
Screenshot 2024-06-07 at 4 29 43 PM

@keithwillcode keithwillcode modified the milestones: v4.2, v4.3 Jun 17, 2024
@dosubot dosubot bot modified the milestone: v4.3 Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty A bounty on Algora.io community Created by Linear-GitHub Sync 🙋🏻‍♂️help wanted Help from the community is appreciated i18n area: i18n, translations Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3880] remove i18n for all <Meta> or figure out how to SSR
3 participants