1 |
|
2 | const __devLocales = {};
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const getLocalesObject = () => {
|
11 | if (__SERVER__) {
|
12 | if (__DEV__) {
|
13 | return __devLocales;
|
14 | } else if (typeof __KOOT_SSR__ === 'object')
|
15 | return __KOOT_SSR__.locales;
|
16 | }
|
17 | if (__CLIENT__) {
|
18 | if (typeof __KOOT_SSR_STATE__ === 'object') {
|
19 | return __KOOT_SSR_STATE__.locales;
|
20 | }
|
21 | }
|
22 | return false;
|
23 | };
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export const locales = (() => getLocalesObject() || {})();
|
32 |
|
33 | export const setLocales = (newLocales = {}) => {
|
34 |
|
35 | if (locales) Object.assign(locales, newLocales);
|
36 |
|
37 | return locales;
|
38 | };
|
39 |
|
40 | export default locales;
|