Hello, in my next 14 app, I'm using next-intl with cookies for translation to 11 languages in my app. There a some static parts in my app that are only in english and not translated.
Now I need to add another language for translating that parts and also the urls, the tricky part for me is now i need to have the language prefix on the url for that translated language. So I need to wrap the whole app with [locale] folder, but now I have prefixes for both. How to handle it dynamically?
#Localizing pathnames with and without language prefix
9 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
I would suggest to remove the locale of the cookies and trust the url. The url will be set automatically by a middleware to ensure that you have a locale everytime
but i dont want to have prefix on the url for each language. For now, I just want that for one language with localized pathnames, others should see the same
then you can't use a dynamic url segment. What you can do is: you can use searchParams. If there is a searchparam for lang for example visible, you know that you need to translate it
One example for that is googles documentation:
how can i handle localizing the pathname if i use searchparams
the same as you would do with the searchParam. Instead of getting it from params you can get it from searchPararms. You can see both here: https://nextjs.org/docs/app/api-reference/file-conventions/page
@lusty ibex solved?