Files
calendar/apps/web/playwright/lib/localize.ts
T
Udit TakkarandGitHub 596e9b4e5a fix: circular dependencies (#20378)
* fix: circular dependencies

* fix: type err
2025-03-26 12:42:40 -04:00

12 lines
429 B
TypeScript

import { loadJSON } from "./loadJSON";
// Provide an standalone localize utility not managed by next-i18n
export async function localize(locale: string) {
const localeModule = `../../public/static/locales/${locale}/common.json`;
const localeMap = loadJSON(localeModule);
return (message: string) => {
if (message in localeMap) return localeMap[message];
throw "No locale found for the given entry message";
};
}