Join the Webstudio community

Updated 4 months ago

How does localization work?

At a glance

The post asks how to create a website that supports two languages and how the CMS content will be translated. Community members suggest that the CMS should store the content, and the dynamic pages can fetch the appropriate language and slug based on the URL. There is a discussion about detecting the user's browser locale and automatically setting the language, with some community members suggesting using the "Accept-Language" header or a separate issue to investigate this further. However, there is no explicitly marked answer in the comments.

Useful resources
How can i create a website that supports two languages and how is the cms content going to be translated?
1
J
R
a
17 comments
The CMS is responsible for storing the content so up to you how its translated. Then in your dynamic page you could do /:lang/:slug and fetch the proper lang and slug based on whats in the URL
THX John ! Is there any way to get the actual "Browser locale" via a kind of "on load" event into a globel variable ? e.g. If the site is loaded from an location in Sweden "se" I'll like to set it to /:se/slug ?
@Oleg Isonen Is this something we should do when working on the Slot task? Quick search brought me to this, not sure if its useful https://jfranciscosousa.com/blog/locale-detection-with-remix-run
Hmmh , I'm not sure what you mean with "... we should do when working on the Slot task?" But I guess it's helpful/necessary to know initially which locale is current using opens the site to be prepared for setting the /:lang... path dynamically , or ?
our Time component is supposed to be doing the dates formatting right
Yes it does via a binding to the language
yes, so what's the issue? or is this about access to global variables from slot?
oh the issue is that without access to global you can't pass language to the Time component?
Request is to auto select the lang based on person's location/browser preferences
this is something to consider separately, these things need to work server-side or allternatively would have to load the site in one language then on the client with js do the detection based on anything else and redirect
there is accept language in the request header, so it seems like its possible to choose the language based on it
I would create a separate issue for us to look into it
Add a reply
Sign up and join the conversation on Discord