Last week we released one of our most requested features: theme translation & site localisation.

This was a community project developed almost entirely by open source contributor Juan, with support from the Ghost Foundation team.

We've written up a full page documentation for this feature, but here's a quick overview of how everything works:

Blog localisation

You can now set the language of your site under Ghost Admin / Settings / General, which will output in the new {{lang}} theme helper to let search engines and other robots know what language your content is in. Eg.

<html lang="{{lang}}">

Setting a language will also automatically update things like the {{date}} helper to output in the format appropriate to the language chosen.

Theme translations

Optionally, you can now also create translated strings within Ghost themes. So rather than using a plain text label like...

<p>Upcoming Events</p>

You can wrap the string with a new {{t}} helper to make it translatable

<p>{{t "Upcoming Events"}}</p>

"Upcoming Events" will be passed as translation key to the translation helper and falls back as the value if no translation file exists.

The next thing you'll do is create a translation key look-up file for your default theme language in a locales directory. So your-theme/locales/en.json

{
    "Back": "Back",
    "Newer Posts": "Newer Posts",
    "of": "of",
    "Older Posts": "Older Posts",
    "Page": "Page",
}

To add a Spanish translation, create your-theme/locales/es.json

{
    "Back": "Volver",
    "Newer Posts": "Artículos Siguientes",
    "of": "de",
    "Older Posts": "Artículos Anteriores",
    "Page": "Página",
}

Now when someone sets their language setting in Ghost Admin, if the appropriate translation file exists within the theme - it will be used.


Ghost(Pro) users have already been updated and have access to this feature within their admin area. Self hosted developers can use Ghost-CLI to get this feature by running $ ghost update to install the latest release.


Interested in developing a community project? Swing by our slack channel and leave a message in our #contributing channel.