Skip to content

Override language routing #681

Answered by aralroca
mfteuscher asked this question in Q&A
Sep 2, 2021 · 7 comments · 9 replies
Discussion options

You must be logged in to vote

All the i18n routing is a feature from Next.js not from this library, documented here: https://nextjs.org/docs/advanced-features/i18n-routing. So in principle, it is not supported.

Maybe you can achieve this by using the I18nProvider on top of your application, where the lang is stored by you and controlled by you.

https://github.com/vinissimus/next-translate#i18nprovider

Something like:

import React, { useContext, createContext } from 'react'
import I18nProvider from 'next-translate/I18nProvider'
import useTranslation from 'next-translate/useTranslation'

const I18nCtx = createContext()

export function I18nWrapper({ children }) {
  const i18n = useTranslation()
  const [lang, changeLang] =

Replies: 7 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@mfteuscher
Comment options

@mfteuscher
Comment options

@aralroca
Comment options

@VinceBT-BG
Comment options

Answer selected by mfteuscher
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@mattvb91
Comment options

@BartoGabriel
Comment options

@mattvb91
Comment options

@mikey-mo
Comment options

Comment options

You must be logged in to vote
1 reply
@aralroca
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet