Publish to Ghost

Translate the words in your theme

Most words in your theme are words you typed in Fantasma, such as headings, buttons and form labels. For a site in one language, type them in that language. Ghost shows a site in one language at a time, and Fantasma has no setting for a language. To change the few words built into the theme, you edit a file inside the theme ZIP.

Set your site's language in Ghost

In Ghost Admin, open Settings and set the publication language in the general settings, as a language code such as de for German. Ghost uses it for its own parts of your site, such as the sign-up and account windows, and it tells browsers and search engines which language your pages are in.

Write your words in your language

Click any text on the canvas and type over it, as Edit text on the canvas shows. This also covers the words around post data, such as "By" before the author's name. The words in an empty form field, such as "Type your email...", are the field's Placeholder: select the field on the canvas and change Placeholder in the right sidebar.

A few words are built into blocks and cannot be typed over, such as "Light", "Dark" and "System" in the Dark Mode Toggle's menu, and labels that only screen readers hear. They change only with a locale file.

Add a locale file to the ZIP

Every theme ZIP has a locale file, locales/en.json, a plain text file that lists the theme's words. Ghost picks the locale file named after your publication language, such as de.json, and shows each word as that file says. A word missing from it shows as typed in Fantasma. Use it for the built-in words, or to switch a finished design to another language without retyping each word in Fantasma.

  1. Download your theme, as Download your theme and upload it in Ghost shows.
  2. Unzip it. Inside is one folder named after your theme, and inside that the locales folder.
  3. Copy en.json and name the copy after the exact language code you set in Ghost, such as de.json.
  4. Open the copy in a code editor, or in a plain text editor that keeps straight quotes. On each line, translate the second quoted text and leave the first as it is. For example, "Subscribe": "Subscribe" becomes "Subscribe": "Abonnieren". Keep every quote mark and comma. A missing one breaks the file, so paste it into any online JSON checker before you go on.
  5. Zip the theme folder again, the folder itself, not the files inside it.
  6. Upload the ZIP in Ghost Admin and activate it, as Download your theme and upload it in Ghost shows.

To change an English word, such as a built-in label, edit it the same way in en.json itself.

Important. Fantasma does not keep your locale file. Every new download builds the ZIP without it, and publishing from Fantasma replaces the theme in Ghost with one that has no translation. So once you translate this way, download and upload the theme by hand instead of publishing. Keep a copy of your file, and add it to each new ZIP before you upload it. To find words you added or changed in Fantasma since then, open the new en.json and your copy side by side, and look for lines your copy lacks. A changed heading is a new line, and its old line is no longer used, so you can delete that one. Each line except the last ends with a comma.

Was this article helpful?