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.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/i18n/const.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2024 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { defineMessage } from "react-intl";
7
8
import { IntlMessage } from "./types";
9
10
// ATTN: these languages have to match the frontend/package.json script "i18n:download",
11
// be valid for Antd (<AntdConfigProvider localize.../>),
12
// and also harmonize with localize::loadLocaleData
13
export const LOCALE = [
14
"en", // that's the default, i.e. user never explicitly selected a language
15
"es",
16
"de",
17
"zh",
18
"ru",
19
"fr",
20
"it",
21
"nl",
22
"ja",
23
"hi",
24
"pt",
25
"ko",
26
"pl",
27
"tr",
28
"he",
29
"hu",
30
"ar",
31
] as const;
32
33
export type Locale = (typeof LOCALE)[number];
34
35
export const DEFAULT_LOCALE: Locale = "en";
36
37
// user's browser is not english, but user wants to keep english
38
// this is only for the account's other_settings and maps to "en"
39
export const KEEP_EN_LOCALE = "en-keep";
40
41
export const OTHER_SETTINGS_LOCALE_KEY = "i18n";
42
43
export const OTHER_SETTINGS_REPLY_ENGLISH_KEY = "llm_reply_english";
44
45
// The ordering is a bit "opinionated". The top languages are European ones, and German has the best quality translations.
46
// Then come other European languges, kind of alphabetical.
47
48
// Then, the Asian group starts with Chinese, as the largest group.
49
export const LOCALIZATIONS: {
50
[key in Locale]: {
51
name: string;
52
flag: string;
53
native: string;
54
trans: IntlMessage;
55
};
56
} = {
57
en: {
58
name: "English",
59
flag: "🇺🇸",
60
native: "English",
61
trans: defineMessage({
62
id: "i18n.localization.lang.english",
63
defaultMessage: "English",
64
}),
65
},
66
de: {
67
name: "German",
68
flag: "🇩🇪",
69
native: "Deutsch",
70
trans: defineMessage({
71
id: "i18n.localization.lang.german",
72
defaultMessage: "German",
73
}),
74
},
75
es: {
76
name: "Spanish",
77
flag: "🇪🇸",
78
native: "Español",
79
trans: defineMessage({
80
id: "i18n.localization.lang.spanish",
81
defaultMessage: "Spanish",
82
}),
83
},
84
fr: {
85
name: "French",
86
flag: "🇫🇷",
87
native: "Français",
88
trans: defineMessage({
89
id: "i18n.localization.lang.french",
90
defaultMessage: "French",
91
}),
92
},
93
it: {
94
name: "Italian",
95
flag: "🇮🇹",
96
native: "Italiano",
97
trans: defineMessage({
98
id: "i18n.localization.lang.italian",
99
defaultMessage: "Italian",
100
}),
101
},
102
nl: {
103
name: "Dutch",
104
flag: "🇳🇱",
105
native: "Nederlands",
106
trans: defineMessage({
107
id: "i18n.localization.lang.dutch",
108
defaultMessage: "Dutch",
109
}),
110
},
111
pl: {
112
name: "Polish",
113
flag: "🇵🇱",
114
native: "Polski",
115
trans: defineMessage({
116
id: "i18n.localization.lang.polish",
117
defaultMessage: "Polish",
118
}),
119
},
120
hu: {
121
name: "Hungarian",
122
flag: "🇭🇺",
123
native: "Magyar",
124
trans: defineMessage({
125
id: "i18n.localization.lang.hungarian",
126
defaultMessage: "Hungarian",
127
}),
128
},
129
ar: {
130
name: "Arabic",
131
flag: "🇪🇬",
132
native: "العربية",
133
trans: defineMessage({
134
id: "i18n.localization.lang.arabic",
135
defaultMessage: "Arabic",
136
}),
137
},
138
pt: {
139
name: "Portuguese",
140
flag: "🇵🇹",
141
native: "Português",
142
trans: defineMessage({
143
id: "i18n.localization.lang.portuguese",
144
defaultMessage: "Portuguese",
145
}),
146
},
147
tr: {
148
name: "Turkish",
149
flag: "🇹🇷",
150
native: "Türkçe",
151
trans: defineMessage({
152
id: "i18n.localization.lang.turkish",
153
defaultMessage: "Turkish",
154
}),
155
},
156
he: {
157
name: "Hebrew",
158
flag: "🇮🇱",
159
native: "עִבְרִית",
160
trans: defineMessage({
161
id: "i18n.localization.lang.hebrew",
162
defaultMessage: "Hebrew",
163
}),
164
},
165
zh: {
166
name: "Chinese",
167
flag: "🇨🇳",
168
native: "中文",
169
trans: defineMessage({
170
id: "i18n.localization.lang.chinese",
171
defaultMessage: "Chinese",
172
}),
173
},
174
ja: {
175
name: "Japanese",
176
flag: "🇯🇵",
177
native: "日本語",
178
trans: defineMessage({
179
id: "i18n.localization.lang.japanese",
180
defaultMessage: "Japanese",
181
}),
182
},
183
hi: {
184
name: "Hindi",
185
flag: "🇮🇳",
186
native: "हिन्दी",
187
trans: defineMessage({
188
id: "i18n.localization.lang.hindi",
189
defaultMessage: "Hindi",
190
}),
191
},
192
ko: {
193
name: "Korean",
194
flag: "🇰🇷",
195
native: "한국어",
196
trans: defineMessage({
197
id: "i18n.localization.lang.korean",
198
defaultMessage: "Korean",
199
}),
200
},
201
ru: {
202
name: "Russian",
203
flag: "🇷🇺",
204
native: "Русский",
205
trans: defineMessage({
206
id: "i18n.localization.lang.russian",
207
defaultMessage: "Russian",
208
}),
209
},
210
} as const;
211
212