Cal.com website breaks when language change button pressed
Issue Summary
On the homepage of Cal.com. When I press the language change button in the footer, the website breaks saying a client-side exception happened.
Steps to Reproduce
- Go to the footer of the Cal.com website
- Press the button saying "English" and the languages icon.
- The website breaks.
Actual Results
The website is breaking with a client-side exception.
Expected Results
There should be an option to change the language
Technical details
- Happening in all the latest browsers.
Evidence
https://www.loom.com/share/8873a67ae3914fb498051824cdd9e6a8?sid=839d0754-9050-4cdb-8938-db7818108ec8
Hey there, @thepradipvc! 👋 I'm Dosu, a friendly bot here to tackle bugs, answer your queries, and guide you through contributing while we wait for a human maintainer to join us. I'm diving into your issue about the language toggle snafu on Cal.com and will get back to you with some insights real soon. 🛠️😄
I was trying to find the code for this but couldn't. Then I stumbled upon the cal.com handbook where there is a mention of the website app. But I couldn't find any app named website. Is is not public or what?
The Cal.com website's code, including the functionality for changing languages, is located in the apps/web directory of the repository, referred to as @calcom/web within the apps/web/package.json. This is the "website app" mentioned in the Cal.com handbook.
For the language change issue you're encountering, it's related to how the website handles locale changes. The functionality involves dynamic locale and direction handling, particularly in the apps/web/pages/_document.tsx file, where the lang and dir attributes of the Html component are set based on the user's locale. This locale determination and setting are crucial for the language change feature to work correctly.
The translations for various text elements are stored in the apps/web/public/static/locales/ directory. The getLocale function from @calcom/features/auth/lib/getLocale is utilized to determine the user's locale, influencing the dynamic setting of language attributes on the website.
To assist further with the client-side exception you're facing, it would be beneficial to have the exact error message or details of the exception. This information would enable a more precise diagnosis of the issue.
Details
Sources
- Cal.com site is broken
- [CAL-667] update lang="" in when changing language
- i18n is flickering
- packages/platform/examples/base/src/pages/_document.tsx
- apps/web/pages/_document.tsx
- packages/app-store/routing-forms/pages/forms/[...appPages].tsx
- packages/app-store/routing-forms/components/SingleForm.tsx
- apps/web/components/I18nLanguageHandler.tsx
- apps/web/public/static/locales/es/common.json
- packages/lib/getLocaleFromRequest.ts
- apps/web/public/static/locales/zh-CN/common.json
- apps/web/public/static/locales/zh-TW/common.json
- apps/web/package.json
- packages/features/auth/lib/getLocale.ts
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Hey , Im new to the Open source contributing. I would like to solve this issue if it's possible. Do I need some approval or I can just fork the project and try to fix the issue?
I think this issue is resolved
Thank you @kmakkar20213 for updating the status. I'm closing this issue.