@beinformed/ui 1.62.7 → 1.62.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/esm/constants/Settings.d.ts +1 -0
- package/esm/constants/Settings.js +4 -0
- package/esm/constants/Settings.js.flow +5 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/react-client/client.d.ts +1 -1
- package/esm/react-client/client.js +19 -0
- package/esm/react-client/client.js.flow +23 -1
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/serverUtil.js +2 -2
- package/esm/react-server/serverUtil.js.flow +2 -2
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/redux/_i18n/I18nActions.js.flow +0 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js +11 -3
- package/esm/redux/_i18n/I18nReducer.js.flow +11 -3
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/reducers/createReducer.js +2 -2
- package/esm/redux/reducers/createReducer.js.flow +1 -1
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js +0 -5
- package/esm/redux/store/configureStore.js.flow +0 -7
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/utils/datetime/DateTimeUtil.js +3 -2
- package/esm/utils/datetime/DateTimeUtil.js.flow +3 -1
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/constants/Settings.d.ts +1 -0
- package/lib/constants/Settings.js +7 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/react-client/client.d.ts +1 -1
- package/lib/react-client/client.js +20 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/serverUtil.js +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js +10 -2
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/reducers/createReducer.js +2 -2
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +0 -5
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +2 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/package.json +8 -8
- package/src/constants/Settings.js +5 -1
- package/src/react-client/client.js +23 -1
- package/src/react-server/serverUtil.js +2 -2
- package/src/redux/_i18n/I18nActions.js +0 -1
- package/src/redux/_i18n/I18nReducer.js +11 -3
- package/src/redux/reducers/createReducer.js +1 -1
- package/src/redux/store/configureStore.js +0 -7
- package/src/utils/datetime/DateTimeUtil.js +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import Cache from "../../utils/browser/Cache";
|
|
3
|
-
import { setCookie } from "../../utils/browser/Cookies";
|
|
3
|
+
import { setCookie, clearCookie } from "../../utils/browser/Cookies";
|
|
4
4
|
|
|
5
5
|
import Locales from "../../i18n/Locales";
|
|
6
6
|
|
|
@@ -12,7 +12,11 @@ import type { ReduxAction } from "../types";
|
|
|
12
12
|
*/
|
|
13
13
|
const updateLocale = (state: I18nState, locale: string) => {
|
|
14
14
|
// set locale in cookie
|
|
15
|
-
|
|
15
|
+
if (state.locales?.length > 1) {
|
|
16
|
+
setCookie("locale", locale);
|
|
17
|
+
} else {
|
|
18
|
+
clearCookie("locale");
|
|
19
|
+
}
|
|
16
20
|
|
|
17
21
|
// clear cache because of cached contributions
|
|
18
22
|
Cache.clear();
|
|
@@ -30,7 +34,11 @@ const setLocales = (
|
|
|
30
34
|
{ locale, locales }: { locale: string, locales: Locales },
|
|
31
35
|
) => {
|
|
32
36
|
// set locale in cookie
|
|
33
|
-
|
|
37
|
+
if (state.locales.length > 1) {
|
|
38
|
+
setCookie("locale", locale);
|
|
39
|
+
} else {
|
|
40
|
+
clearCookie("locale");
|
|
41
|
+
}
|
|
34
42
|
|
|
35
43
|
if (locale) {
|
|
36
44
|
return {
|
|
@@ -42,6 +42,7 @@ type Reducers = {
|
|
|
42
42
|
/**
|
|
43
43
|
*/
|
|
44
44
|
export const createReducer = (): Reducers => ({
|
|
45
|
+
preferences: PreferencesReducer,
|
|
45
46
|
router: RouterReducer,
|
|
46
47
|
modularui: ModularUIReducer,
|
|
47
48
|
i18n: I18nReducer,
|
|
@@ -51,5 +52,4 @@ export const createReducer = (): Reducers => ({
|
|
|
51
52
|
modelcatalog: ModelCatalogReducer,
|
|
52
53
|
notification: NotificationReducer,
|
|
53
54
|
progressindicator: ProgressIndicatorReducer,
|
|
54
|
-
preferences: PreferencesReducer,
|
|
55
55
|
});
|
|
@@ -13,8 +13,6 @@ import { modularUIMiddleware } from "../_modularui/ModularUIMiddleware";
|
|
|
13
13
|
import { createReducer } from "../reducers/createReducer";
|
|
14
14
|
import { locationChange } from "../_router/RouterActions";
|
|
15
15
|
|
|
16
|
-
import { updateLocale } from "../_i18n/I18nActions";
|
|
17
|
-
|
|
18
16
|
import type { RouterHistory } from "react-router";
|
|
19
17
|
import type { ReduxAction, ReduxState, ReduxStore } from "../types";
|
|
20
18
|
import type { Reducer } from "redux";
|
|
@@ -55,11 +53,6 @@ const configureStore = (
|
|
|
55
53
|
store.dispatch(locationChange(routerHistory.location, "PUSH"));
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
const locale = initialState?.i18n.locale;
|
|
59
|
-
if (locale) {
|
|
60
|
-
store.dispatch(updateLocale(locale));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
56
|
return { routerHistory, store };
|
|
64
57
|
};
|
|
65
58
|
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
DATETIME_OFFSET_FORMAT,
|
|
26
26
|
DEFAULT_FIRST_WEEK_CONTAINS_DATE,
|
|
27
27
|
DEFAULT_WEEK_STARTS_ON,
|
|
28
|
+
getEnabledLocales,
|
|
28
29
|
getSetting,
|
|
29
30
|
IS_GRAALJS,
|
|
30
31
|
isIncludeTimeOffsetInDateTimes,
|
|
@@ -136,7 +137,8 @@ class BaseDateTimeUtil {
|
|
|
136
137
|
/**
|
|
137
138
|
*/
|
|
138
139
|
getLocale(): typeof nl | typeof enGB {
|
|
139
|
-
const
|
|
140
|
+
const defaultLocale = getEnabledLocales()[0];
|
|
141
|
+
const locale = getCookie("locale") ?? defaultLocale ?? "en";
|
|
140
142
|
|
|
141
143
|
if (locale === "nl") {
|
|
142
144
|
return nl;
|