#Invisible Internationalization?

11 messages · Page 1 of 1 (latest)

modest star
#

Is there a way to make internationalization invisible (no /en, de or whatever in the URL) like in normal React projects using i18n?
This type of URL just doesn't look good for webapps and often just causes issues when people with different language settings share URLs. I want to prevent that.

vast sandalBOT
#

🔎 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)

rocky harness
modest star
#

Or can I maybe use the approach Next.js features in their documentation but cookie-based rather than URL-based?

rocky harness
# modest star I use next-themes for dark mode. But you mean storing the language info in the l...

I don’t know how i18n “usually works” on normal react projects, so can’t comment on that.

A typical i18n solution would rely on the url to provide locale information, but since you want it to be invisible that’s not applicable.

Then the only way to do it is by using a state-based solution. Which is like the way you would handle theming.

That said, just don’t. The locale params provide language info not only to users but to search engines as well - you don’t want to prevent German version of your pages from showing on Google right? Secondly, to resolve the problem of sharing URLs, you can simply handle redirection when an incoming request has the locale different from the expected language in the header

#

Putting the locale in the url is an established good practice and you should follow that

modest star
#

SEO doesn't matter for this since it won't show up in search engines either way. That's why I'm focusing on usability which would be better if there was no language in the URL

#

If I share a YT link with you, you don't want to suddenly have your YouTube switch to german because the URL says so. That's what I want to prevent here

rocky harness