Questions tagged [next-i18next]
165 questions
2
votes
1 answer
Failed to load static props with empty paths and fallback
I have the following code on my Dynamic Routing page [id] that I am trying to use with next-i18next translations. However, it is throwing an error when being deployed on Vercel (working locally). I am trying to use the fallback function with an…

sebdev
- 93
- 1
- 6
2
votes
1 answer
next js use getStaticProps and serverSideProps
I use Next js for store site and my site has multi language capability. My question is how to use getStaticProps, getServerSideProps on a page with static and dynamic data?
_app.js
import {appWithTranslation} from "next-i18next";
const MyApp =…

pouria khazaei
- 64
- 6
2
votes
0 answers
Next.js: Adding next-i18next to a project that uses next-auth
One-sentence summary
When I have await serverSideTranslations inside getStaticProps, loading value from useSession() remains stuck as true.
Context
I use next-auth.js (v3) for auth. I have (gratefully) used this for a year without a problem.
const…

Mark
- 1,285
- 1
- 19
- 28
2
votes
0 answers
How to i change the color of only certain characters in a json file?
I'm working on multilingual using next.js and next-i18n.
Let me ask you a question through the example below.
Json File
{
"test": "Hi, this string value will change. Thank you"
}
example
t("test")
So, I want it to change like the image below.
I…

Jundev
- 93
- 1
- 7
2
votes
1 answer
Why doesn't my session load when switching locales?
I am using Next.js in combination with next-auth and next-i18next.
I use useSession() (with the next-auth/client Provider in my _app.js) to check if the user is authenticated. Once authenticated, navigation is very quick and the current session is…

Thom
- 21
- 2
2
votes
2 answers
Next-i18next serverSideTranslations initialI18nStore missing locales
export const getStaticProps: GetStaticProps = async (context) => {
const { locale } = context;
const translations = await serverSideTranslations(locale, ["common"]);
console.log(translations._nextI18Next.initialI18nStore)
}
is showing only…

Topliceanu Razvan
- 51
- 6
2
votes
1 answer
Next-i18next translation on the fly
Is there a way to translate something using the next-i18next library without changing the locale with router.push?
I have 3 locales: ['en', 'de', 'fr'], the default being de. When I am trying to do something like:
import {useTranslation} from…

Topliceanu Razvan
- 51
- 6
2
votes
0 answers
Next JS i18Next build serverSideTranslations error
I am trying to build my react NEXT JS application, but after I run
npm run build
I am getting this error:
Error occurred prerendering page "/it/landing". Read more: https://nextjs.org/docs/messages/prerender-error
Error: next-i18next was unable to…

Alessandro Pierro
- 21
- 1
- 2
2
votes
1 answer
Next.js locale files are getting 404 because of setting basePath?
Locale files are getting 404 , because of adding basePath ,
What i have tried i18n.tsx
const NextI18NextInstance = new NextI18Next({
defaultLanguage: 'en',
otherLanguages: ['de'],
fallbackLng: 'en',
localeSubpaths,
localePath:…

Gopinath Kaliappan
- 6,929
- 8
- 37
- 60
2
votes
3 answers
next-i18next - Is it possible to change default language dynamically?
I'm using next-i18next to handle internationalization of my next.js app.
Is it possible to change default language dynamically?
For example based on the top level domain?
const defaultLanguage = topLevelDomain === "de" : "de" ? "it";
EDIT: I'm also…

Piotr O
- 427
- 1
- 5
- 16
2
votes
2 answers
next-i18next unit testing error 'Cannot read property language of undefined' with Link and jest
next-i18next uses it's own Link component to be compatible with locale sub-paths.
https://github.com/isaachinman/next-i18next
When I try a simple snapshot test I get the error Cannot read property language of undefined.
My component:
import React…

RyanP13
- 7,413
- 27
- 96
- 166
2
votes
0 answers
declaring namespacesRequired array on page-level component
I've got a project based on next and react, using i18next package I encounter the following warning which I think is the reason why it takes plenty of time to load i18n according to react profiler:
You have not declared a namespacesRequired array…

ali emili
- 538
- 2
- 6
- 19
2
votes
0 answers
Next-i18next double render
I am working on a react+next project using the next-i18next package for localization.
I noticed an intermittent issue that seems to be occurring in both Chrome and FF and looks to be related to the next-i18next package itself. When any page is…

ayr
- 21
- 1
2
votes
1 answer
How to config appWithTranslation(nexti18next + withRedux (next-redux-wrapper) in __app.js
I'm tranfer reactjs project to nextjs with react-redux, redux, nexti18next, next-redux-wrapper here is _app.js and redux.js it run right but if i add withRedux it is error. Please tell me how to resolve this problem or advide me some…

Thanh Danh
- 23
- 4
1
vote
0 answers
Remove /en prefix from url | nextjs 13 app directory
I'm usign i18next app directory and i'm wondoring if there is an option to remove language prefix from url
My goal
to have url like this
en for home page example.com
en for login page example.com/login
fr for home page example.com
fr for login page…

u-bx31
- 11
- 2