Skip to content

Languages reference

Markdown
  • A site comes in every language of the business’s current site. ws site --languages en,fr sets them; the first is the main one, at /.
  • One page file serves every language. about.html makes /about in English and /fr/about in French, or the address addresses: 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 in locales/en.json, locales/fr.json and so on. The t filter 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 marks translate: true, plus the body; the rest come from the main file.
  • ws push refuses 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 with languages: [...].
  • 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 push still 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 push refuses 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.