CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/locales/lib.ts
Views: 791
1
import type { I18nDictionary } from "next-translate";
2
3
import { unreachable } from "@cocalc/util/misc";
4
import type { Locale } from "./misc";
5
6
async function getIndexMessages(locale: Locale): Promise<I18nDictionary> {
7
switch (locale) {
8
case "en":
9
return (await import("locales/en/index.json")).default;
10
case "de":
11
return (await import("locales/de/index.json")).default;
12
case "es":
13
return (await import("locales/es/index.json")).default;
14
case "zh":
15
return (await import("locales/zh/index.json")).default;
16
case "ru":
17
return (await import("locales/ru/index.json")).default;
18
case "fr":
19
return (await import("locales/fr/index.json")).default;
20
case "it":
21
return (await import("locales/it/index.json")).default;
22
case "nl":
23
return (await import("locales/nl/index.json")).default;
24
case "ja":
25
return (await import("locales/ja/index.json")).default;
26
case "hi":
27
return (await import("locales/hi/index.json")).default;
28
case "pt":
29
return (await import("locales/pt/index.json")).default;
30
case "ko":
31
return (await import("locales/ko/index.json")).default;
32
case "pl":
33
return (await import("locales/pl/index.json")).default;
34
case "tr":
35
return (await import("locales/tr/index.json")).default;
36
case "he":
37
return (await import("locales/he/index.json")).default;
38
case "hu":
39
return (await import("locales/hu/index.json")).default;
40
case "ar":
41
return (await import("locales/ar/index.json")).default;
42
default:
43
unreachable(locale);
44
}
45
return {};
46
}
47
48
export async function getI18nMessages(locale: Locale) {
49
return {
50
index: await getIndexMessages(locale),
51
};
52
}
53
54