-
Notifications
You must be signed in to change notification settings - Fork 344
/
i18n.ts
61 lines (57 loc) · 1.04 KB
/
i18n.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { notFound } from 'next/navigation';
import { getRequestConfig } from 'next-intl/server';
export const languages = [
{
code: 'en-US',
lang: 'en',
label: 'English',
},
{
code: 'ja-JP',
lang: 'jp',
label: '日本語',
},
{
code: 'de-DE',
lang: 'de',
label: 'Deutsch',
},
{
code: 'es-ES',
lang: 'es',
label: 'Español',
},
{
code: 'fr-FR',
lang: 'fr',
label: 'Français',
},
{
code: 'pt-BR',
lang: 'pt',
label: 'Português',
},
{
code: 'ru-RU',
lang: 'ru',
label: 'Русский',
},
{
code: 'zh-CN',
lang: 'cn',
label: '简体中文',
},
{
code: 'zh-TW',
lang: 'tw',
label: '繁體中文',
},
];
export const locales = languages.map((lang) => lang.lang);
export default getRequestConfig(async ({ locale }) => {
// Validate that the incoming `locale` parameter is valid
if (!locales.includes(locale as any)) notFound();
return {
messages: (await import(`./messages/${locale}.json`)).default,
};
});