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