-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathnext-intl.mjs
More file actions
31 lines (23 loc) · 835 Bytes
/
next-intl.mjs
File metadata and controls
31 lines (23 loc) · 835 Bytes
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
'use strict';
export const useTranslations = () => {
const t = key => key;
t.rich = key => key;
t.markup = key => key;
return t;
};
export const useFormatter = () => {
const formatter = format => new Intl.DateTimeFormat('en-US', format);
return {
date: (date, format) => formatter(format).format(date),
dateTime: (date, format) => formatter(format).format(date),
};
};
export const NextIntlClientProvider = ({ children }) => children;
export const createNavigation = () => ({
Link: props => <a {...props} onClick={e => e.preventDefault()} />,
redirect: () => void null,
usePathname: () => '',
useRouter: () => ({ push: () => void null, replace: () => void null }),
});
// eslint-disable-next-line react-hooks/rules-of-hooks
export const getTranslations = () => Promise.resolve(useTranslations());