Languages reference
Ce contenu n’est pas encore disponible dans votre langue.
Languages
Section titled “Languages”- A site comes in every language of the business’s current site.
ws site --languages en,frsets them; the first is the main one, at/. - One page file serves every language.
about.htmlmakes/aboutin English and/fr/aboutin French, or the addressaddresses:gives. Its HTML and Liquid are written once. - Strings are the short texts on a page, such as headings, buttons, menu labels and form labels. Each has a name, such as
menu.about, and a text in each language, kept inlocales/en.json,locales/fr.jsonand so on. Thetfilter prints the string with that name in the page’s language. A dot in the name steps into the file’s nested names, as in Shopify themes:
<a href="{{ '/about' | lang_path }}">{{ 'menu.about' | t }}</a><!-- On a French page: <a href="/fr/a-propos">À propos</a> -->- Longer writing goes in a
{% text %}block, written in Markdown, with one part per language:
{% text %}Saltmere Marina has 140 slips on the south shore of Nova Scotia.{% in 'fr' %}La marina Saltmere compte 140 places sur la rive sud de la Nouvelle-Écosse.{% endtext %}The first part is in the main language. Each {% in %} starts another.
- Data in another language goes in
_data/fr/(for French), with the same file names. The French copy holds only the fields its folder’s schema markstranslate: true, plus thebody; the rest come from the main file. ws pushrefuses a site with anything missing in a language: a string that a language’s locales file does not have, a{% text %}block without a part for each language, a data record without its translated fields, or a page with no address in a language. A page meant for some languages only says so withlanguages: [...].- The coding agent the builder works with writes the translations in the same change as the main language. Nobody checks them before they are published.
- If a change alters main-language text and leaves its translation as it was,
ws pushstill publishes, and lists those translations, so you can check you meant it. The owner’s tools mark them too. - The owner sees each language side by side with the main one in their account, and can correct any translation. Their correction is published like any change. Their wording is kept: if a later change from a folder would replace it,
ws pushrefuses and names the line. When the main-language text of a line the owner corrected changes, the line is marked for the owner to look at again.