Skip to content

Commit

Permalink
Use i18next-fetch-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
SalamaGofore committed May 23, 2024
1 parent f76b854 commit 337c3b7
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 111 deletions.
219 changes: 114 additions & 105 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@tanstack/react-query-devtools": "^5.29.2",
"cookie": "^0.6.0",
"i18next": "^23.11.4",
"i18next-http-backend": "^2.5.1",
"i18next-fetch-backend": "^6.0.0",
"next": "^14.2.2",
"nuqs": "^1.17.2",
"react": "^18",
Expand Down
9 changes: 4 additions & 5 deletions src/app/lib/localization/localizations.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use client';

import HttpBackend from 'i18next-http-backend';
import Fetch from 'i18next-fetch-backend';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import { isDev } from '../configuration';

export const createLocalizationProvider = () => {
i18n
.use(HttpBackend)
.use(Fetch)
.use(initReactI18next)
.init({
debug: isDev,
Expand All @@ -16,10 +16,9 @@ export const createLocalizationProvider = () => {
lng: 'fi',
backend: {
loadPath: '{{lng}}',
request: (
options: [],
fetch: (
url: string,
payload: unknown,
options: [],
callback: (a: unknown, b?: unknown) => void,
) => {
fetch(`/valintojen-toteuttaminen/lokalisaatio?lng=${url}`)
Expand Down

0 comments on commit 337c3b7

Please sign in to comment.