ublo-lib 1.8.12 → 1.8.13
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
2
3
|
import classnames from "classnames";
|
|
3
4
|
import Button from "dt-design-system/es/button";
|
|
4
5
|
import { useGoal } from "../plausible";
|
|
5
|
-
import
|
|
6
|
+
import message from "./messages";
|
|
6
7
|
import css from "./error-404.module.css";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -11,6 +12,15 @@ const Error404 = ({
|
|
|
11
12
|
className
|
|
12
13
|
}) => {
|
|
13
14
|
useGoal("404 error");
|
|
15
|
+
const {
|
|
16
|
+
lang: ubloLang
|
|
17
|
+
} = useUbloContext();
|
|
18
|
+
const [lang, setLang] = React.useState(ubloLang);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (!lang) {
|
|
21
|
+
setLang(document.documentElement.getAttribute("lang") || "en");
|
|
22
|
+
}
|
|
23
|
+
}, [lang]);
|
|
14
24
|
const classes = classnames(css.error, className);
|
|
15
25
|
return _jsxs("div", {
|
|
16
26
|
className: classes,
|
|
@@ -21,21 +31,15 @@ const Error404 = ({
|
|
|
21
31
|
className: css.inner,
|
|
22
32
|
children: [_jsx("div", {
|
|
23
33
|
className: css.title,
|
|
24
|
-
children:
|
|
25
|
-
id: "title"
|
|
26
|
-
})
|
|
34
|
+
children: message(lang, "title")
|
|
27
35
|
}), _jsx("div", {
|
|
28
36
|
className: css.tagline,
|
|
29
|
-
children:
|
|
30
|
-
id: "tagline"
|
|
31
|
-
})
|
|
37
|
+
children: message(lang, "tagline")
|
|
32
38
|
}), _jsx(Button, {
|
|
33
39
|
tag: "a",
|
|
34
40
|
className: css.button,
|
|
35
41
|
href: "/",
|
|
36
|
-
children:
|
|
37
|
-
id: "button"
|
|
38
|
-
})
|
|
42
|
+
children: message(lang, "button")
|
|
39
43
|
}), _jsx("div", {
|
|
40
44
|
className: css.errorCode,
|
|
41
45
|
children: "404"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useUbloContext } from "ublo/with-ublo";
|
|
2
1
|
const messages = {
|
|
3
2
|
fr: {
|
|
4
3
|
title: "Erreur",
|
|
@@ -11,16 +10,7 @@ const messages = {
|
|
|
11
10
|
button: "Back to home page"
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
|
-
|
|
13
|
+
export default function message(lang, id) {
|
|
15
14
|
const _lang = lang === "fr" ? "fr" : "en";
|
|
16
15
|
return messages[_lang]?.[id] || `??${id}??`;
|
|
17
|
-
}
|
|
18
|
-
export const Message = ({
|
|
19
|
-
id
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
lang
|
|
23
|
-
} = useUbloContext();
|
|
24
|
-
return message(lang, id);
|
|
25
|
-
};
|
|
26
|
-
export default Message;
|
|
16
|
+
}
|