Casper 3.0 translate question

I am making casper translate ready, i can’t figure out how to make this piece of text translate friendly

Original
<h1 class="subscribe-overlay-title">Subscribe to {{@site.title}}</h1>

Translate version
<h1 class="subscribe-overlay-title">{{t "Subscribe to {{@site.title}}"}}</h1>

The one below keep giving me error 500.

Please advice :slight_smile:

Try this:

{{t "Subscribe to {siteTitle}" siteTitle=@site.title}}

1 Like

The code worked, but the translation is not working that’s the only thing missing for translating casper 3.0

"Subscribe to {@site.title}": "Suscríbete a {@site.title}",

Anyway thanks for your help :slight_smile:

So you need to create a translation file locales/es.json

{
   "Subscribe to {siteTitle}": "Suscríbete a {siteTitle}"
}

and then set the language from the Ghost admin (Publication Language) as es if you are using Spanish.

More info at https://ghost.org/docs/api/v3/handlebars-themes/helpers/translate/

2 Likes

Thank you so much for taking your time, this is what i did. I already got all the theme translate except that part. I tried the one you suggested but not working for me.

May be you need to restart Ghost. Make sure to follow the docs steps.

1 Like

I already did multiple times, i going to keep trying. Thank you again

1 Like

Nevermind you were right thanks :slight_smile:

1 Like