Revert "refactor: replace i18n HTTP requests with build-time bundling (#22422)" (#22496)

This reverts commit 163c7ff791.
This commit is contained in:
Benny Joo authored and GitHub committed 2025-07-14 22:49:25 +00:00
1 parent fe4946a269
commit c8a52b78e1
62 files changed
+87 -175

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
with:
filters: |
has-files-requiring-all-checks:
- "!(**.md|.github/CODEOWNERS|docs/**|help/**|packages/lib/server/locales/**/common.json)"
- "!(**.md|.github/CODEOWNERS|docs/**|help/**|apps/web/public/static/locales/**/common.json)"
- name: Get Latest Commit SHA
id: get_sha
run: |
+1 -1
View File
@@ -5,7 +5,7 @@ const i18nConfig = require("@calcom/config/next-i18next.config");
/** @type {import("next-i18next").UserConfig} */
const config = {
...i18nConfig,
localePath: path.resolve("../../packages/lib/server/locales"),
localePath: path.resolve("../../web/public/static/locales"),
};
module.exports = config;
@@ -32,7 +32,7 @@ const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
const eventLocale = props.eventData?.interfaceLanguage;
const ns = "common";
let translations: Record<string, string> = {};
let translations;
if (eventLocale) {
const ns = "common";
translations = await loadTranslations(eventLocale, ns);
@@ -68,7 +68,7 @@ const ServerPage = async ({ params, searchParams }: PageProps) => {
const eventLocale = props.eventData?.interfaceLanguage;
const ns = "common";
let translations: Record<string, string> = {};
let translations;
if (eventLocale) {
const ns = "common";
translations = await loadTranslations(eventLocale, ns);
+1 -1
View File
@@ -1,5 +1,5 @@
require("dotenv").config({ path: "../../.env" });
const englishTranslation = require("../../packages/lib/server/locales/en/common.json");
const englishTranslation = require("./public/static/locales/en/common.json");
const { withAxiom } = require("next-axiom");
const { version } = require("./package.json");
const {
+1 -1
View File
@@ -15,7 +15,7 @@
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"sentry:release": "NODE_OPTIONS='--max-old-space-size=6144' node scripts/create-sentry-release.js",
"copy-static": "node scripts/copy-app-store-static.js && node scripts/copy-locales-static.js",
"copy-static": "node scripts/copy-app-store-static.js",
"build": "yarn copy-static && next build && yarn sentry:release",
"start": "next start",
"lint": "eslint . --ignore-path .gitignore",
+1 -1
View File
@@ -2,7 +2,7 @@ import { loadJSON } from "./loadJSON";
// Provide an standalone localize utility not managed by next-i18n
export async function localize(locale: string) {
const localeModule = `../../../../packages/lib/server/locales/${locale}/common.json`;
const localeModule = `../../public/static/locales/${locale}/common.json`;
const localeMap = loadJSON(localeModule);
return (message: string) => {
if (message in localeMap) return localeMap[message];
@@ -3360,4 +3360,4 @@
"license_key_saved": "تم حفظ مفتاح الترخيص بنجاح",
"timezone_mismatch_tooltip": "أنت تشاهد التقرير بناءً على المنطقة الزمنية لملفك الشخصي ({{userTimezone}})، بينما متصفحك مضبوط على المنطقة الزمنية ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ أضف السلاسل الجديدة أعلاه هنا ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Lisenziya açarı uğurla saxlanıldı",
"timezone_mismatch_tooltip": "Siz hesabatı profil saat qurşağınıza ({{userTimezone}}) əsasən görürsünüz, brauzeriniz isə başqa saat qurşağına ({{browserTimezone}}) təyin edilib",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Yeni sətirləri bura əlavə edin ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Лицензионният ключ е успешно записан",
"timezone_mismatch_tooltip": "Преглеждате отчета според часовата зона на вашия профил ({{userTimezone}}), докато браузърът ви е настроен на часова зона ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Добавете новите си низове над този ред ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "লাইসেন্স কী সফলভাবে সংরক্ষিত হয়েছে",
"timezone_mismatch_tooltip": "আপনি আপনার প্রোফাইল টাইমজোন ({{userTimezone}}) অনুসারে রিপোর্ট দেখছেন, যখন আপনার ব্রাউজার টাইমজোন ({{browserTimezone}}) এ সেট করা আছে",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑ুষান্ত"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Clau de llicència desada correctament",
"timezone_mismatch_tooltip": "Esteu veient l'informe basat en la zona horària del vostre perfil ({{userTimezone}}), mentre que el vostre navegador està configurat a la zona horària ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Afegiu les vostres noves cadenes a dalt ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licenční klíč byl úspěšně uložen",
"timezone_mismatch_tooltip": "Prohlížíte si report na základě časového pásma vašeho profilu ({{userTimezone}}), zatímco váš prohlížeč je nastaven na časové pásmo ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Přidejte své nové řetězce nahoru ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licensnøgle blev gemt med succes",
"timezone_mismatch_tooltip": "Du ser rapporten baseret på din profils tidszone ({{userTimezone}}), mens din browser er indstillet til tidszonen ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Tilføj dine nye strenge ovenfor her ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Το κλειδί άδειας αποθηκεύτηκε με επιτυχία",
"timezone_mismatch_tooltip": "Βλέπετε την αναφορά με βάση τη ζώνη ώρας του προφίλ σας ({{userTimezone}}), ενώ ο περιηγητής σας είναι ρυθμισμένος στη ζώνη ώρας ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Προσθέστε τις νέες συμβολοσειρές σας πάνω από εδώ ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -284,7 +284,7 @@
"guests": "Guests",
"guest": "Guest",
"web_conferencing_details_to_follow": "Web conferencing details to follow in the confirmation email.",
"confirmation": "Confirmation",
"confirmation":"Confirmation",
"what_booker_should_provide": "What your booker should provide to receive confirmations",
"404_the_user": "The username",
"username": "Username",
@@ -3360,4 +3360,4 @@
"license_key_saved": "Clave de licencia guardada correctamente",
"timezone_mismatch_tooltip": "Estás viendo el informe basado en la zona horaria de tu perfil ({{userTimezone}}), mientras que tu navegador está configurado en la zona horaria ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Agrega tus nuevas cadenas arriba de esta línea ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Clave de licencia guardada correctamente",
"timezone_mismatch_tooltip": "Estás viendo el informe basado en la zona horaria de tu perfil ({{userTimezone}}), mientras que tu navegador está configurado en la zona horaria ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Agregue sus nuevas cadenas arriba ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Litsentsivõti salvestati edukalt",
"timezone_mismatch_tooltip": "Te vaatate aruannet oma profiili ajavööndi ({{userTimezone}}) alusel, samal ajal kui teie brauser on seadistatud ajavööndisse ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Lizentzia gakoa ondo gorde da",
"timezone_mismatch_tooltip": "Txostena zure profileko ordu-zonaren arabera ikusten ari zara ({{userTimezone}}), zure nabigatzailea ordu-zona honetan ezarrita dagoen bitartean ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Gehitu zure kate berriak honen gainean ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Lisenssiavain tallennettu onnistuneesti",
"timezone_mismatch_tooltip": "Tarkastelet raporttia profiilisi aikavyöhykkeen ({{userTimezone}}) mukaan, kun taas selaimesi on asetettu aikavyöhykkeelle ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Lisää uudet merkkijonot tämän yläpuolelle ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "מפתח הרישיון נשמר בהצלחה",
"timezone_mismatch_tooltip": "אתה צופה בדוח על בסיס אזור הזמן של הפרופיל שלך ({{userTimezone}}), בעוד שהדפדפן שלך מוגדר לאזור זמן ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -453,4 +453,4 @@
"reschedule_cta_short": "Zakažite ponovno ovdje.",
"you_and_conjunction": "Vi &",
"email_survey_triggered_by_workflow": "Ova anketa je pokrenuta Workflow-om u Calu."
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "A licenckulcs sikeresen mentve",
"timezone_mismatch_tooltip": "A jelentést az Ön profiljában beállított időzóna ({{userTimezone}}) alapján tekinti meg, míg a böngészője a következő időzónára van állítva: {{browserTimezone}}",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Adja hozzá az új karakterláncokat fent ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -166,4 +166,4 @@
"reschedule_cta_short": "Jadwal ulang di sini.",
"you_and_conjunction": "Anda &",
"email_survey_triggered_by_workflow": "Survei ini dipicu oleh Workflow di Cal."
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Chiave di licenza salvata con successo",
"timezone_mismatch_tooltip": "Stai visualizzando il report in base al fuso orario del tuo profilo ({{userTimezone}}), mentre il tuo browser è impostato sul fuso orario ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Aggiungi le tue nuove stringhe qui sopra ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "ライセンスキーが正常に保存されました",
"timezone_mismatch_tooltip": "あなたはプロフィールのタイムゾーン({{userTimezone}})に基づいてレポートを表示していますが、ブラウザのタイムゾーンは({{browserTimezone}})に設定されています",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ この上に新しい文字列を追加してください ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "សោអាជ្ញាប័ណ្ណត្រូវបានរក្សាទុកដោយជោគជ័យ",
"timezone_mismatch_tooltip": "អ្នកកំពុងមើលរបាយការណ៍ដោយផ្អែកលើតំបន់ពេលវេលាប្រវត្តិរូបរបស់អ្នក ({{userTimezone}}) ខណៈពេលដែលកម្មវិធីរុករករបស់អ្នកត្រូវបានកំណត់ទៅតំបន់ពេលវេលា ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ បន្ថែមខ្សែអក្សរថ្មីរបស់អ្នកនៅខាងលើនេះ ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "라이선스 키가 성공적으로 저장되었습니다",
"timezone_mismatch_tooltip": "프로필 시간대({{userTimezone}})를 기준으로 보고서를 보고 계시지만, 브라우저는 다른 시간대({{browserTimezone}})로 설정되어 있습니다",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ 여기에 새 문자열을 추가하세요 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -162,4 +162,4 @@
"reschedule_cta_short": "Pārzīmēt šeit.",
"you_and_conjunction": "Jūs &",
"email_survey_triggered_by_workflow": "Šo aptauju aktivizēja darbplūsma Cal."
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licentiesleutel succesvol opgeslagen",
"timezone_mismatch_tooltip": "Je bekijkt het rapport op basis van je profieltijdzone ({{userTimezone}}), terwijl je browser is ingesteld op tijdzone ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Voeg uw nieuwe strings hierboven toe ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Lisenssnøkkel lagret",
"timezone_mismatch_tooltip": "Du ser rapporten basert på tidssonen i profilen din ({{userTimezone}}), mens nettleseren din er satt til tidssonen ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Legg til dine nye strenger over her ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Chave de licença salva com sucesso",
"timezone_mismatch_tooltip": "Você está visualizando o relatório com base no fuso horário do seu perfil ({{userTimezone}}), enquanto seu navegador está configurado para o fuso horário ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Adicione suas novas strings aqui em cima ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Chave de licença salva com sucesso",
"timezone_mismatch_tooltip": "Você está visualizando o relatório com base no fuso horário do seu perfil ({{userTimezone}}), enquanto seu navegador está configurado para o fuso horário ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Cheia de licență a fost salvată cu succes",
"timezone_mismatch_tooltip": "Vizualizați raportul pe baza fusului orar al profilului dvs. ({{userTimezone}}), în timp ce browserul dvs. este setat pe fusul orar ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Adăugați stringurile noi deasupra acestui rând ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Лицензионный ключ успешно сохранён",
"timezone_mismatch_tooltip": "Вы просматриваете отчёт в часовом поясе вашего профиля ({{userTimezone}}), в то время как ваш браузер настроен на часовой пояс ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Добавьте строки выше ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licenčný kľúč bol úspešne uložený",
"timezone_mismatch_tooltip": "Prezeráte si správu na základe časového pásma vášho profilu ({{userTimezone}}), zatiaľ čo váš prehliadač je nastavený na časové pásmo ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Pridajte svoje nové reťazce nad túto líniu ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -67,4 +67,4 @@
"reschedule_cta_short": "Preplánujte tu.",
"you_and_conjunction": "Vy &",
"email_survey_triggered_by_workflow": "Tento prieskum bol spustený pracovným postupom v Cal."
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licencni ključ je uspešno sačuvan",
"timezone_mismatch_tooltip": "Gledate izveštaj na osnovu vremenske zone vašeg profila ({{userTimezone}}), dok je vaš pretraživač podešen na vremensku zonu ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Dodajte svoje nove stringove iznad ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Licensnyckeln sparades framgångsrikt",
"timezone_mismatch_tooltip": "Du tittar på rapporten baserat på din profiltidszon ({{userTimezone}}), medan din webbläsare är inställd på tidszonen ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -211,4 +211,4 @@
"reschedule_cta_short": "இங்கே மீண்டும் ஷெடியூல் செய்யவும்.",
"you_and_conjunction": "நீங்கள் &",
"email_survey_triggered_by_workflow": "இந்த ஆய்வு Cal-ல் உள்ள பணிப்பாய்வு மூலம் தூண்டப்பட்டது."
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Lisans anahtarı başarıyla kaydedildi",
"timezone_mismatch_tooltip": "Raporu profil saat diliminize ({{userTimezone}}) göre görüntülüyorsunuz, ancak tarayıcınız ({{browserTimezone}}) saat dilimine ayarlı",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Yeni dizelerinizi yukarıya ekleyin ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Ліцензійний ключ успішно збережено",
"timezone_mismatch_tooltip": "Ви переглядаєте звіт на основі часового поясу вашого профілю ({{userTimezone}}), тоді як у вашому браузері встановлено часовий пояс ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "Đã lưu khóa giấy phép thành công",
"timezone_mismatch_tooltip": "Bạn đang xem báo cáo dựa trên múi giờ hồ sơ của bạn ({{userTimezone}}), trong khi trình duyệt của bạn được đặt theo múi giờ ({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "许可证密钥已成功保存",
"timezone_mismatch_tooltip": "您正在根据您的个人资料时区({{userTimezone}})查看报告,而您的浏览器设置为时区({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ 在此上方添加您的新字符串 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3360,4 +3360,4 @@
"license_key_saved": "授權金鑰已成功儲存",
"timezone_mismatch_tooltip": "您正在根據您的個人資料時區({{userTimezone}})查看報告,而您的瀏覽器設置為時區({{browserTimezone}})",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ 請在此處新增您的字串 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3,7 +3,7 @@ import { join } from "path";
const TEMPLATE_LANGUAGE = "en";
const SPECIFIC_LOCALES = process.argv.slice(2) || [];
const LOCALES_PATH = join(__dirname, "../../../packages/lib/server/locales");
const LOCALES_PATH = join(__dirname, "../public/static/locales");
const ALL_LOCALES = readdirSync(LOCALES_PATH);
-25
View File
@@ -1,25 +0,0 @@
const fs = require("fs");
const path = require("path");
const glob = require("glob");
const copyLocalesStatic = () => {
const localeFiles = glob.sync("../../packages/lib/server/locales/**/*.json", { nodir: true });
localeFiles.forEach((file) => {
const relativePath = file.replace("../../packages/lib/server/locales/", "");
// Create destination directory if it doesn't exist
const destDir = path.join(process.cwd(), "public", "static", "locales", path.dirname(relativePath));
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
// Copy file to destination
const destPath = path.join(process.cwd(), "public", "static", "locales", relativePath);
fs.copyFileSync(file, destPath);
console.log(`Copied ${file} to ${destPath}`);
});
};
// Run the copy function
copyLocalesStatic();
+1 -1
View File
@@ -23,7 +23,7 @@ const translationKeyRegex = /(?<!\w)(?:t\(("[^"]*")(?:,\s*\{[^}]*\})?\)|i18nKey=
/** @type {import("i18n-unused/src/types/index.ts").RunOptions} */
const config = {
// localesPath: localePath, // uncomment to run on all locales (to calculate kb savings)
localesPath: path.join("./packages/lib/server/locales", "/en"),
localesPath: path.join("./apps/website", "/public/static/locales", "/en"),
srcPath: "./apps/website",
srcExtensions: ["ts", "tsx"],
translationContextSeparator: ":",
+1 -1
View File
@@ -43,7 +43,7 @@
},
"buckets": {
"json": {
"include": ["packages/lib/server/locales/[locale]/common.json"]
"include": ["apps/web/public/static/locales/[locale]/common.json"]
}
},
"$schema": "https://lingo.dev/schema/i18n.json"
@@ -2,9 +2,9 @@ import { createInstance } from "i18next";
import { expect, test, describe } from "vitest";
import { getTranslation } from "@calcom/lib/server/i18n";
import en from "@calcom/lib/server/locales/en/common.json";
import { TimeFormat } from "@calcom/lib/timeFormat";
import { WorkflowActions, WorkflowTemplates } from "@calcom/prisma/enums";
import en from "@calcom/web/public/static/locales/en/common.json";
import { getTemplateBodyForAction } from "../actionHelperFunctions";
import compareReminderBodyToTemplate from "../compareReminderBodyToTemplate";
+1 -1
View File
@@ -1,9 +1,9 @@
import type { Prisma } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import { getTranslation } from "@calcom/lib/server/i18n";
import { parseRecurringEvent } from "./isRecurringEvent";
import { getTranslation } from "./server/i18n";
type DestinationCalendar = {
id: number;
+22 -17
View File
@@ -1,6 +1,6 @@
import { createInstance } from "i18next";
import { CALCOM_VERSION } from "@calcom/lib/constants";
import { WEBAPP_URL } from "@calcom/lib/constants";
const translationCache = new Map<string, Record<string, string>>();
const i18nInstanceCache = new Map<string, any>();
@@ -10,25 +10,27 @@ const i18nInstanceCache = new Map<string, any>();
* Implements caching to avoid redundant network requests
* @returns {Promise<Record<string, string>>} English translations object or empty object on failure
*/
async function loadFallbackTranslations(): Promise<Record<string, string>> {
const cacheKey = `en-common-${CALCOM_VERSION}`;
async function loadFallbackTranslations() {
const cacheKey = "en-common";
if (translationCache.has(cacheKey)) {
return translationCache.get(cacheKey)!;
return translationCache.get(cacheKey);
}
try {
const { getBundledTranslations } = await import("./translationBundler");
const translations = getBundledTranslations("en", "common");
const res = await fetch(`${WEBAPP_URL}/static/locales/en/common.json`, {
cache: process.env.NODE_ENV === "production" ? "force-cache" : "no-store",
});
if (Object.keys(translations).length === 0) {
throw new Error("No English fallback translations found");
if (!res.ok) {
throw new Error(`Failed to fetch fallback translations: ${res.status}`);
}
const translations = await res.json();
translationCache.set(cacheKey, translations);
return translations;
} catch (error) {
console.error("Could not load fallback translations:", error);
console.error("Could not fetch fallback translations:", error);
return {};
}
}
@@ -39,22 +41,25 @@ async function loadFallbackTranslations(): Promise<Record<string, string>> {
* @param {string} ns - The namespace for the translations
* @returns {Promise<Record<string, string>>} Translations object or fallback translations on failure
*/
export async function loadTranslations(_locale: string, ns: string): Promise<Record<string, string>> {
export async function loadTranslations(_locale: string, ns: string) {
const locale = _locale === "zh" ? "zh-CN" : _locale;
const cacheKey = `${locale}-${ns}-${CALCOM_VERSION}`;
const cacheKey = `${locale}-${ns}`;
if (translationCache.has(cacheKey)) {
return translationCache.get(cacheKey)!;
return translationCache.get(cacheKey);
}
try {
const { getBundledTranslations } = await import("./translationBundler");
const translations = getBundledTranslations(locale, ns);
const url = `${WEBAPP_URL}/static/locales/${locale}/${ns}.json`;
const response = await fetch(url, {
cache: process.env.NODE_ENV === "production" ? "force-cache" : "no-store",
});
if (Object.keys(translations).length === 0) {
throw new Error(`No translations found for ${locale}/${ns}`);
if (!response.ok) {
throw new Error(`Failed to fetch translations: ${response.status}`);
}
const translations = await response.json();
translationCache.set(cacheKey, translations);
return translations;
} catch (error) {
@@ -71,7 +76,7 @@ export async function loadTranslations(_locale: string, ns: string): Promise<Rec
* @returns {Promise<Function>} A translation function bound to the specified locale and namespace
*/
export const getTranslation = async (locale: string, ns: string) => {
const cacheKey = `${locale}-${ns}-${CALCOM_VERSION}`;
const cacheKey = `${locale}-${ns}`;
if (i18nInstanceCache.has(cacheKey)) {
return i18nInstanceCache.get(cacheKey).getFixedT(locale, ns);
}
-68
View File
@@ -1,68 +0,0 @@
import { readFileSync } from "fs";
import { join } from "path";
import path from "path";
import { CALCOM_VERSION } from "@calcom/lib/constants";
function findMonorepoRoot(): string {
let currentDir = process.cwd();
while (currentDir !== path.dirname(currentDir)) {
try {
const packageJsonPath = path.join(currentDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
if (packageJson.workspaces && packageJson.name === "calcom-monorepo") {
return currentDir;
}
} catch (error) {
// package.json doesn't exist in this directory
// Just continue to the next directory
}
currentDir = path.dirname(currentDir);
}
return process.cwd();
}
const LOCALES_PATH = path.join(findMonorepoRoot(), "packages/lib/server/locales");
interface LocaleCache {
[cacheKey: string]: Record<string, string>;
}
let localeCache: LocaleCache = {};
let cacheVersion: string | null = null;
function loadTranslationForLocale(locale: string, ns: string): Record<string, string> {
const cacheKey = `${locale}-${ns}-${CALCOM_VERSION}`;
if (cacheVersion === CALCOM_VERSION && localeCache[cacheKey]) {
return localeCache[cacheKey];
}
if (cacheVersion !== CALCOM_VERSION) {
localeCache = {};
cacheVersion = CALCOM_VERSION;
}
try {
const translationPath = join(LOCALES_PATH, locale, `${ns}.json`);
const translations = JSON.parse(readFileSync(translationPath, "utf-8"));
localeCache[cacheKey] = translations;
return translations;
} catch (error) {
console.warn(`Failed to load translations for ${locale}/${ns}:`, error);
return {};
}
}
export function getBundledTranslations(locale: string, ns: string): Record<string, string> {
const normalizedLocale = locale === "zh" ? "zh-CN" : locale;
const translations = loadTranslationForLocale(normalizedLocale, ns);
if (Object.keys(translations).length > 0) {
return translations;
}
const englishTranslations = loadTranslationForLocale("en", ns);
return englishTranslations;
}
@@ -3,14 +3,14 @@ import type { ReactNode } from "react";
import { useState } from "react";
import { useCallback } from "react";
import deTranslations from "@calcom/lib/server/locales/de/common.json";
import enTranslations from "@calcom/lib/server/locales/en/common.json";
import esTranslations from "@calcom/lib/server/locales/es/common.json";
import frTranslations from "@calcom/lib/server/locales/fr/common.json";
import nlTranslations from "@calcom/lib/server/locales/nl/common.json";
import ptBrTranslations from "@calcom/lib/server/locales/pt-BR/common.json";
import type { API_VERSIONS_ENUM } from "@calcom/platform-constants";
import { IconSprites } from "@calcom/ui/components/icon";
import deTranslations from "@calcom/web/public/static/locales/de/common.json";
import enTranslations from "@calcom/web/public/static/locales/en/common.json";
import esTranslations from "@calcom/web/public/static/locales/es/common.json";
import frTranslations from "@calcom/web/public/static/locales/fr/common.json";
import nlTranslations from "@calcom/web/public/static/locales/nl/common.json";
import ptBrTranslations from "@calcom/web/public/static/locales/pt-BR/common.json";
import { AtomsContext } from "../hooks/useAtomsContext";
import { useMe } from "../hooks/useMe";
@@ -1,9 +1,9 @@
import type deTranslations from "@calcom/lib/server/locales/de/common.json";
import type enTranslations from "@calcom/lib/server/locales/en/common.json";
import type esTranslations from "@calcom/lib/server/locales/es/common.json";
import type frTranslations from "@calcom/lib/server/locales/fr/common.json";
import type nlTranslations from "@calcom/lib/server/locales/nl/common.json";
import type ptBrTranslations from "@calcom/lib/server/locales/pt-BR/common.json";
import type deTranslations from "@calcom/web/public/static/locales/de/common.json";
import type enTranslations from "@calcom/web/public/static/locales/en/common.json";
import type esTranslations from "@calcom/web/public/static/locales/es/common.json";
import type frTranslations from "@calcom/web/public/static/locales/fr/common.json";
import type nlTranslations from "@calcom/web/public/static/locales/nl/common.json";
import type ptBrTranslations from "@calcom/web/public/static/locales/pt-BR/common.json";
export type enTranslationKeys = keyof typeof enTranslations;
export type frTranslationKeys = keyof typeof frTranslations;
+2 -2
View File
@@ -62,9 +62,9 @@ export default defineConfig(({ mode }) => {
"@calcom/platform-constants": path.resolve(__dirname, "../constants/index.ts"),
"@calcom/platform-types": path.resolve(__dirname, "../types/index.ts"),
"@calcom/platform-utils": path.resolve(__dirname, "../constants/index.ts"),
"@calcom/lib/server/locales/en/common.json": path.resolve(
"@calcom/web/public/static/locales/en/common.json": path.resolve(
__dirname,
"../../lib/server/locales/en/common.json"
"../../../apps/web/public/static/locales/en/common.json"
),
},
},