Join the Webstudio community

Updated 12 months ago

Support Multilingualism

At a glance

The post discusses implementing multilingual support in a web platform. The community members propose allowing users to change the HTML lang attribute, controlling language per folder, and using the meta tag for language detection. The comments provide feedback, noting that the lang attribute does not impact SEO, and that a simpler approach of allowing language selection in page settings would be more user-friendly. There is also discussion around using a fixed list of languages and validating language tags according to BCP 47 standards. The community members agree that the platform should provide a way to set the language, and that more advanced localization features may be explored in the future.

Useful resources
I know, it's always a tricky subject to implement.

Also I'm not an expert, so maybe my understanding, explanation and proposal make no sense. 😉
But here how I see it.

1st step

could be to allow the user to change the lang attribute at the HTML level.

Which would allow user to publish websites in others languages than english without hurting their SEO.

2nd phase

would be to allow to control the language per folder, such as if I make a folder fr and define the language at the level then the pages and folders under that would have lang="fr" as global attributes

https://www.w3schools.com/tags/att_global_lang.asp

What do you think.
1
O
B
J
31 comments
  1. You can already create a language per folder (without lang attribute)
  1. Localization often requires multiple people working on the content, which is something the CMS should take care of, not Webstudio.
So multilingual case we need specifically to support from webstudio is a simpler one, where the builder/designer takes care of it.
I would also question if the meta <meta http-equiv="content-language” content=""> has impact, I would expect the search engines to detect the language themselves.
maybe it makes sense t allow setting language and then render both lang attribute and the meta tag .... if that helps search engines at all
Meta can be added right now in any case with custom meta tag
Would be more user friendly if that would be a pre-defined field that can be selected
lang is important to force browsers to suggest translating website and not confuse languages
Providing a lang attribute with a valid language tag according to RFC 5646: Tags for Identifying Languages (also known as BCP 47) on the <html> element will help screen reading technology determine the proper language to announce
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
I would add it as part of page settings. Would let for cms to specify it.
that's a very good reason, even if its not important for SEO
also I think there is a fixed list of languages, so we can use combobox and let user choose
There are thousands of values. I would go with parser as validator
https://www.npmjs.com/package/bcp-47
Wow, thank you for your prompt and passionate replies, it give me a warm confidence on why I should stick with WebStudio
Do you think that only the 1st part of the ISO-639 is suffisante
since it seams to require at least 2 characters.
https://www.npmjs.com/package/bcp-47#function-warningreason-code-offset
Would you mind to give me a concrete example?
Right now here is my logic
./Home( a portal page in english)
  • en/*
  • fr/*
  • es/*
It is inspired by WoWChemy based on Hugo which is able to detect the language and redirect the user automatically
do you know languages with just 1 char?
currently what we gonna support is just additional language field in page settings
in the future we will explore more options for localization
I don't understand you question, do I'll say no I don't, didn't know. :p
I mean bcp-47 is "en", "en-US" etc. It's what supported by html lang attribute
Choosing the language based on user client or location is a complex topic. Ideally you don't use location for that at all. It's a popular mistake.

Browser language is also misleading, I might have my browser in en, but consume content in a different language.

Really the only good way is to not assume and let user choose. URL should be the only deciding thing.
Build a lang select. Decide on your default language. Done.
Additionally one can save the setting for returning visitors in local storage or session storage and/or account settings if there is a login, but that's an optimization for advanced use cases. Just to let them see the language if they actively chose that one.
Yes; as an Expat who travel a lot; I rage after that detail so often. 😉
so; to resume; if now I want to make 2 websites, one in English and one in French on 2 differents subdomain; then I link them via an menu
their is a way I could ensure the fr in the html attribute ?
No, we can do better than this, it can be one website, and you can bind the lang attribute to the parameter in the url e.g. /en/something will allow you to have lang="en"
In fact I think we just made it possible with this pr https://github.com/webstudio-is/webstudio/pull/2928
When will this be live?
Together with CMS launch
Add a reply
Sign up and join the conversation on Discord