Ghost casper theme translation not working - [post.hbs] Cannot read property 'length' of undefined

Dear Ghost community,

I’m stuck with a translation issue in Ghost (theme casper) which I haven’t found any solution yet, so I thought I give it a shot by posting my issue here.

I’m using Ghost Version 2.25.3 and Casper theme (I don’t know which version of casper cause it’s not mentioned in the read me).

I’m willing to translate my Blog to German to make it available for the German audience on top of the default English. I’ve managed to make the posts available in multiple languages following these steps: Tutorial: A complete guide to translation & multi-language content in Ghost

Now I’m willing to use the translation helper {{t}} in my .hbs files so that I can make the fixed theme content translatable in the en.json and de.json files.
I followed all the steps here: Ghost Handlebars Theme Helpers: translate

Basically I did:

  1. Add the folder “locales” in my theme folder
  2. Created the “en.json” and “de.json” files in which I’ve added this (just one variable for the first try)
    “readmore”: “Mehr lesen”
  3. Replaced the html language tag by this: < html lang="{{@site.locale}}"> in default.hbs
  4. Added pagination.hbs and navigation.hbs in partials.
  5. Went to byline-single.hbs and add the translation helper like following:
    < a class=“author-card-button” href="{{url}}">{{t readmore}}
  6. Saved everything and restarted Ghost.

Now Ghost runs but as soon as I open a blog post I get following error:
[post.hbs] Cannot read property ‘length’ of undefined
[Go to the front page →]

I have no idea where the log files are, couldn’t find them.

So if anyone had the same experience, or has an idea what the problem could be I’d gladly take it.

Thanks :wink:

Hi Nico,

Your Ghost version went EOL in January - this means it’s no longer supported or receiving any security patches. Please upgrade!