Questions tagged [next-i18next]

165 questions
4
votes
0 answers

Content cannot translated and tests are failed on jest in next-i18next

I am using Next-i18next package for my localization purposes in my project. I successfully rendered translated content on my UI. But when I try to test my content and text with enzym (shallow testing) and jest-dom, the tests are failed because the…
4
votes
4 answers

next-i18next is not working with serversideprops in dynamic pages after deploying on vercel

I'm using next-i18next module for multilingual support. I have some static pages and dynamic pages as well. both working fine on local. I deployed all static pages on vercel, all worked fine on vercel. But dynamic page is not working on vercel. it…
Prashant Patil
  • 2,463
  • 1
  • 15
  • 33
4
votes
0 answers

Can't make next-i18next to work in subdirectory

I'm trying to generate ssg project with next + next-i18next. If I build my project on local machine everything works. I can't make it to work on production. Production version is in subcategory: example.com/app and that's probably the problem (can't…
4
votes
2 answers

NextJS Optional catch all routes not working when deployed

We have a project that contains one dynamic route [productId], and inside this page, we have several other pages that include optional catch-all routes. Here is the structure on the pages folder: [productId] contentOne [[...slugOne]] The…
4
votes
1 answer

next-i18next with next-rewrite does not work with root page rewrite path

We have an existing app, where the root "/" gets redirected to "/search" by default. It's been working fine via our next-redirects.js file: async function redirects() { return [ { source: '/', destination: '/search', …
Phil Lucks
  • 2,704
  • 6
  • 31
  • 57
4
votes
1 answer

Access next-i18next translations outside of page/component

I'm building Next.JS application with Typescript and would like to access next-i18next translations outside of page/component, in order to localize validation messages, while all the validation engine is defined in separate utility class. Have…
saniokazzz
  • 476
  • 1
  • 6
  • 21
4
votes
1 answer

Add translation on server side only using next-i18next

Scenario: We have a server that responds to several domains (70+) Each domain has it own language (already in an individual JSON file) I have a map "domain":"translation.json" Each client has a single language: a user visiting "example.com" will…
Falci
  • 1,823
  • 4
  • 29
  • 54
3
votes
0 answers

How to modify bootstrap file according to language in NextJS

i have a 2 languages in Next app one of them is: rtl direction and other is: ltr direction How i can import bootstrap css file according to language (default css file or rtl file) useEffect and useLayoutEffect is they are late and am dont do create…
WepDev
  • 66
  • 1
  • 4
3
votes
1 answer

Remove language from URL in Next JS dynamic routes

I have a website in NextJS with next-i18next, and every page must be translated except for the legal pages. These legal pages are in markdown, and I have dynamic routing enabled thanks to a [legal].js page and the getStaticPaths and getStaticProps…
mdubus
  • 110
  • 11
3
votes
2 answers

How to manage i18n routing in next.js to use slash instead of dash

I have a website that have multiple countries and each country has more than one locale here is my next-i18next.config.js module.exports = { i18n: { defaultLocale: 'en-eg', locales: ['en-br', 'en-eg', 'en-ke', 'pt-br', 'pt-eg', 'pt-ke',…
Mahmoud Ashraf
  • 124
  • 1
  • 9
3
votes
2 answers

How to use changeLanguage method in next-i18next for changing locale?

I'm trying to change default locale in my project with just button click. I don't want to change my URL with pushing sub paths like fooo.com/fa. Here is my next-i18next config: module.exports = { i18n: { defaultLocale: 'en', locales:…
3
votes
1 answer

How to avoid the “You have not declared a namespacesRequired array” errors in Next.js?

I used the next-i18next module for a multi-language application. I don’t understand why I am getting the following error, as I have declared the namespaces the same way it is shown in the documentation. The error message: You have not declared a…
Daniil Kedrov
  • 130
  • 1
  • 4
2
votes
0 answers

How can I run code after next-i18next loads translations?

My client-side analytics solution requires me to run some code after all of the translations have been loaded by next-i18next, but I can't figure out how to do this. Specifically, I need to run the code after my document.title has been updated with…
Greg Baker
  • 21
  • 2
2
votes
1 answer

How can I create dynamic metadata that changes for each multilanguage page using Next.js 13.4 and next-intl?

I am just learning nextjs little by little, and I wanted to make a multilanguage page, I am doing it with next-intl, but I am not very good at generatingMetadata, what I want is for it to be dynamic, right now with the code I have if it updates the…
2
votes
0 answers

Getting next config warning adding nex-i18n additional property

when using a path resolution to the locale paths NextJS complains about a property warn - Invalid next.config.js options detected: [ { "instancePath": "/i18n", "schemaPath": "#/properties/i18n/additionalProperties", "keyword":…
Caio Lucas
  • 139
  • 1
  • 4
1
2
3
10 11