question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Locales are not loaded if Shallow Routing

See original GitHub issue

Hi,

In order to change the location and maintain the app state and the current path (Change language while staying on the same route). I ran into this issue: next Router changes the local, but next-translate remains in the current language.

<Link href={router.asPath} locale={lng} key={lng} shallow={true}>...</Link>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aralrocacommented, Feb 23, 2021

I don’t know if there is a way to know if the current navigation comes from shallow routing, if so, maybe we could force the I18nProvider to download the necessary page translations inside a useEffect, so you don’t have to use the above workaround…

0reactions
andrewdorocommented, Sep 18, 2022

I don’t know if there is a way to know if the current navigation comes from shallow routing, if so, maybe we could force the I18nProvider to download the necessary page translations inside a useEffect, so you don’t have to use the above workaround…

also Next can now identify if the route change is using shallow Update: I tried implementing shallow support in the provider, but for some reason the router object is not being updated #917

https://github.com/vercel/next.js/pull/19802 https://nextjs.org/docs/api-reference/next/router#routerevents

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locales are not loaded if Shallow Routing · Issue #518 - GitHub
Hi, In order to change the location and maintain the app state and the current path (Change language while staying on the same...
Read more >
Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific ......
Read more >
Rails routes with scope ":locale" and shallow nested resources
Ah, yes! I found the answer in the API documentation. The magic is in the :shallow_path keyword and in the above example it...
Read more >
Why is shallow routing to a different route not allowed? : r/nextjs
Shallow routing doesnt hit getStaticProps/ initalProps so it wouldn't be to load the page.
Read more >
Client-Side Routing In Next.js - Smashing Magazine
You need to have a working knowledge of React and Next.js to get the ... reside in the pages directory but do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found