Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.0-3 - navigation to wrong translation reloads the app #46

Closed
kruzliak-juraj opened this issue Oct 13, 2022 · 1 comment
Closed

1.9.0-3 - navigation to wrong translation reloads the app #46

kruzliak-juraj opened this issue Oct 13, 2022 · 1 comment

Comments

@kruzliak-juraj
Copy link

Since I can not use 1.8.0 due to this issue I am using the 1.9.0-3

I have this structure:

/author
--[slug].tsx
--_routes.json
[...catchAll].tsx
index.tsx

in routes.json is defined:

{
  "/": {
    "cz": "autori",
    "en": "authors"
  }
}

The issue

When navigating with useRouter or Link from next-translate-routes/link and trying to navigate to the 'incorrectly' translated path the part of path that should be translated stays the same

router.push('cz/author/name-of-author', 'cz/author/name-of-author', { locale: 'cz' })

or

<Link href={'cz/author/name-of-author'} locale={ 'cz' } >

Both route to __domain__/cz/author/name-of-author instead of __domain__/cz/autori/name-of-author. Link also generates the URLs with wrong translation in html.

On full reload, the URLs is properly translated.

@cvolant
Copy link
Collaborator

cvolant commented Nov 2, 2022

Hi @kruzliak-juraj, thanks for the report. I reworked this part before publishing 1.9.0, and it should work now.
I tried to be more compliant with Next docs, and the behaviour may surprise you sometimes: if you want the locale in the href to be taken into account, you need to set locale to false.
Please reopen the issue if you still have bugs.

@cvolant cvolant closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants