Multi-language tutorial followed but not working

I am using Ghost 4.1.0 self-hosted with the Mapache theme and would like to offer some posts in English while most of the posts are in German (default language).
Therefore I followed this tutorial and restarted Ghost but it works only partially.
On the homepage the language gets set correctly (index.hbs and index-en.hbs seem to work) but on posts it doesn’t set any language: Panel Discussion on Remote UX Usability Testing
What did I miss? @DavidDarnes

default.hbs:

<!DOCTYPE html>
<!--
    Design by:
    ——————————
        GODO FREDO
        ✉ https://godofredo.ninja
        ✎ @GodoFredoNinja
        ✈ Lima - Perú
-->
<html lang="{{{block "lang"}}}" data-theme="light">
<head>
    {{!-- Document Settings --}}
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    {{!-- Base Meta --}}
    <title>{{meta_title}}</title>

post.hbs:

{{!-- Layout --}}
{{!< default }}

{{#contentFor "mapache_class_body"}}is-article is-page is-article-single{{/contentFor}}

{{#post}}
  {{#has tag="#en"}}
	{{#contentFor "lang"}}en{{/contentFor}}
  {{else}}
	{{#contentFor "lang"}}{{@site.locale}}{{/contentFor}}
  {{/has}}

<article class="post u-maxWidth740 u-container u-marginAuto u-marginTop30 u-marginBottom40">
    {{!-- Page Title --}}
    <h1 class="post-title u-marginBottom20">{{title}}</h1>

    {{!-- Post Image - partials/helper/helper-article-image.hbs --}}
    {{> "helper/helper-article-image"}}

    {{!-- Page Content --}}
    <div class="post-body">
        <div class="post-inner js-post-content">{{content}}</div>
    </div>
</article>

{{/post}}

And what needs to be done to also use the existing en.json translation if lang=en?
Thanks in advance.

Hey there. Do you know if the other block you’re using on the post template works? I’d try some debugging to find out why it might not be being set. By the way I would swap those handlebars comments for regular HTML comments, it’s not a big issue but they could be messing with the template code and it’s unnecessary parsing for the theme to do.

As for the en.json, please see this note in the tutorial:

Note: Locales and the publication language are for setting a single primary language for the site. They are not designed to provide multiple languages at the same time.

1 Like

At least all the other handlebars load the corresponding content as far as I can see. I have asked the theme author as well.

1 Like