Skip to content

Commit

Permalink
Update i18next to 23
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKalbertodt committed Sep 12, 2023
1 parent 533eb6f commit 181119d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
22 changes: 11 additions & 11 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"focus-trap-react": "^10.2.1",
"graphql": "^16.8.0",
"hls.js": "^1.4.12",
"i18next": "^22.5.1",
"i18next": "^23.5.1",
"i18next-browser-languagedetector": "^7.1.0",
"paella-basic-plugins": "1.31.2",
"paella-core": "1.41.0",
Expand All @@ -49,7 +49,7 @@
"react-beforeunload": "^2.6.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.46.1",
"react-i18next": "^12.3.1",
"react-i18next": "^13.2.2",
"react-icons": "^4.11.0",
"react-markdown": "^8.0.7",
"react-merge-refs": "^2.0.2",
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/util/err.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { i18n, TFuncKey } from "i18next";
import { i18n, ParseKeys } from "i18next";
import React from "react";
import { ReactNode } from "react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -73,13 +73,9 @@ export const errorDisplayInfo = (error: unknown, i18n: i18n): ErrorDisplayInfo =
// Use a message fitting to the exact error key, if it is present.
const translationKey = err.key ? `api-remote-errors.${err.key}` : null;
if (translationKey && i18n.exists(translationKey)) {
const msg = t(translationKey as TFuncKey);

// It could still refer to an object, which would be a bug.
if (typeof msg === "string") {
causes.add(msg);
continue;
}
const msg = t(translationKey as ParseKeys);
causes.add(msg);
continue;
}

// Otherwise, derive an error message from the error kind. We
Expand Down

0 comments on commit 181119d

Please sign in to comment.