Skip to content

Commit

Permalink
Update deps & Add language autodetector
Browse files Browse the repository at this point in the history
Tested to work, probably have to set up buttons for this too, anyway
  • Loading branch information
benjamsf committed Mar 31, 2024
1 parent adccfe0 commit 2da64a4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
15 changes: 12 additions & 3 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"classnames": "^2.3.2",
"formik": "^2.4.5",
"i18next": "23.10.1",
"i18next-browser-languagedetector": "^7.2.1",
"i18next-chained-backend": "^4.6.2",
"i18next-http-backend": "^2.5.0",
"i18next-localstorage-backend": "^4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/locale/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"footer.authenticatedWithMtls": "Tunnistautunut mTLS:llä",
"footer.proudlyServedBy": "Sovelluksen tarjoaa:",
"footer.allRightsReservedFDF": "FDF-UI, PV:n logo & taustakuvat:",
"footer.allRightsReservedFDFnotice": "Puolustusvoimat. Kaikki oikeudet pidätetään",
"footer.allRightsReservedFDFnotice": "Puolustusvoimat. Kaikki oikeudet pidätetään.",
"footer.allRightsReservedPVATK": "PVATK. Kaikki oikeudet pidätetään.",
"footer.feedbackForm": "Kerro palautetta tai ideoita kehittäjille lomakkeella!",

Expand Down
9 changes: 7 additions & 2 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { initReactI18next } from "react-i18next";
import resourcesToBackend from "i18next-resources-to-backend";
import ChainedBackend from "i18next-chained-backend";
import LocalStorageBackend from "i18next-localstorage-backend";
import LanguageDetector from "i18next-browser-languagedetector";

void i18n
.use(ChainedBackend)
.use(initReactI18next)
.use(LanguageDetector)
.init({
lng: "fi",
fallbackLng: "fi",
fallbackLng: "en",
detection: {
order: ["navigator", "localStorage"],
caches: ["localStorage"],
},
backend: {
backends: [
LocalStorageBackend,
Expand Down
2 changes: 2 additions & 0 deletions src/views/servicetak/ServiceTak.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export function ServiceTak() {
variant={{ width: "full" }}
onClick={() => navigate("/app/services/tak/quickstart")}
styling="m-1 px-2"
className="w-full h-full"
>
<div className="flex items-center justify-center w-full h-full">
<img src={phone} alt="keys" className="h-5 w-5 mr-2" />
Expand All @@ -141,6 +142,7 @@ export function ServiceTak() {
variant={{ width: "full" }}
onClick={() => navigate("/app/services/tak/usage")}
styling="m-1 px-2"
className="w-full h-full"
>
<div className="flex items-center justify-center w-full h-full">
<img src={usage} alt="keys" className="h-5 w-5 mr-2" />
Expand Down

0 comments on commit 2da64a4

Please sign in to comment.