Buy me a coffee (opens new window) DE · DeutschDA · Dansk

← Counterglow overview

One site, several languages

A translation is one more file next to the one that is already there.

One site, several languages

New in 1.7.0: a site can speak several languages without a plugin, a database or a second installation. A page stays one folder; a translation is one more file next to the one that is already there. Leave the setting out and nothing changes — same URLs, same files, same HTML.

One file per language
content/3_notes/1_why-flat-files/
  note.txt           ← English, the default language
  note.de.txt        ← German: title, slug, text
  cover.jpg
  cover.jpg.txt      ← alt text and caption
  cover.jpg.de.txt   ← …in German
Named once, in the config
'languages' => [
    'en' => ['name' => 'English', 'default' => true, 'prefix' => false],
    'de' => ['name' => 'Deutsch'],
    'da' => ['name' => 'Dansk'],
],

The same page in English and in German, each with its own address and its own switcher:

  • The English front page of the example company site: the language switcher in the header shows EN.
    The English front page of the example company site: the language switcher in the header shows EN.
  • The same page in German under /de, with the headline and buttons translated; the switcher shows Deutsch.
    The same page in German under /de, with the headline and buttons translated; the switcher shows Deutsch.
  • A translation is a file

    note.txt is the default language, note.de.txt the German version. Every field a translation leaves out falls back to the default language, so a translated page can be a title and a text while date, tags and cover stay in one place. translate: false keeps a price or a product code the same everywhere.

  • Its own address

    Each language gets a prefix (/de/…), and the default language may do without one, so switching a live site to several languages breaks no link. A translation can carry its own slug: /de/impressum next to /en/imprint. Renaming one leaves a redirect behind, for that language.

  • A switcher in every theme

    The core snippet language-switcher sits in the header of all 21 themes: real links with hreflang and lang, the current language marked, and a language without a translation shown as plain text instead of a dead link. On a site with one language it prints nothing at all.

  • Everything else follows

    <html lang> and dir, hreflang with x-default, the canonical address, a sitemap with alternates, one feed and one search index per language, dates in the language of the page — and the same again in the static export.

  • In the panel

    The page editor has a tab per language with its state: default language, translated, out of date or missing. A new translation starts with the default language’s text, slug and history are kept per language, and the overview lists what is still missing where. The panel’s own interface stays English.

  • Nobody is guessed at

    / never redirects by browser language — either the default language lives there or it redirects once to its prefix. A page nobody has translated yet still answers under every prefix and shows the default language, so a menu or a search result never leads nowhere.

The open language switcher in the Quasar header: English, Deutsch and Dansk as plain links, the current language marked.
The open language switcher in the Quasar header: English, Deutsch and Dansk as plain links, the current language marked.
The same switcher in Nova: every theme carries it in its header, in the theme’s own style.
The same switcher in Nova: every theme carries it in its header, in the theme’s own style.
The page editor in German: a tab per language with its state — EN default language, DE translated, DA missing.
The page editor in German: a tab per language with its state — EN default language, DE translated, DA missing.
The Translations card on the panel overview: how many pages are translated per language and which ones are still missing.
The Translations card on the panel overview: how many pages are translated per language and which ones are still missing.

Want to see it? The Company starter kit ships in English, German and Danish with translated addresses — ?preview=quasar&content=business on your own installation.

Free, and it stays that way

Counterglow costs nothing and has no paid edition. If it saves you time, a coffee helps keep it going.

Buy me a coffee ↗ (opens new window)

Read the code, keep the folder.

Questions, ideas or bug reports? Write to me. hello@gerber.media