Why do some translation handles not translate on my self-hosted installation?

F.e. example here, pagination.hbs:

{{!-- This pagination template is used to navigate through newer and older articles. --}}  
<div class="l-wrapper">   
<nav class="m-pagination" aria-label="{{t "Pagination"}}">     
{{#if prev}}       
<a href="{{page_url prev}}" class="m-icon-button filled in-pagination-left" aria-label="{{t "Newer posts"}}">         
<span class="icon-arrow-left"></span>       
</a>     
{{/if}}     
<span class="m-pagination__text">{{t "Page"}} {{page}} {{t "of"}} {{pages}}</span>     
{{#if next}}       
<a href="{{page_url next}}" class="m-icon-button filled in-pagination-right" aria-label="{{t "Older posts"}}">         
<span class="icon-arrow-right"></span>       
</a>     {{/if}}   </nav> </div>    

Page X of Y seems to have the handles set correctly I think.

de-CH.json contains translations for “Page”, “Pages” and “of”:

 "of": "von",
 "Pages": "Seiten",
"Page": "Seite",

navigation.hbs is present too as required, de-CH.json sits in locales. The language is set in the backend:

Yet Ghost only translates some handles while it keeps the english version for others:

Theme is a fork of “liebling” and the Ghost version is 5.100.1. Anyone has an idea why that might be?

My two guesses are:

  1. pagination.hbs is in the wrong place. It needs to be in partials.

  2. You don’t have the locale of the site (set in /ghost > settings) set to exactly match the theme filename. (capitalization, - vs _, etc)

  3. You haven’t restarted Ghost since making changes.

BTW, if you haven’t already seen it, the translation docs include both how to do reading time and handing pagination.

{{t "Page"}} {{page}} {{t "of"}} {{pages}} is not ideal (although it should work in your case) because it assumes the words are always in the listed order. A better approach is:
{{t “Page {page} of {pages}” page=page pages=pages}}

1 Like

Hi Cathy

Oh, thanks so much!

pagination.hbs is in partials, capitalization/wording of “de-CH” should be correct (edit: otherwise it wouldn’t use the translations from de-CH provided by ghost I guess. A file I created and named when I participated a little in translating on GitHub. So on that front I should be fine, no weird dash or so :slight_smile: ).

I haven’t restarted though… me idiot seem to have lost my key to get in. Oh well, if nothing helps I’ll reinstall and setup new keys, haha. Unless their perhaps is a way to restart it from the dashboard to be able to prolong that inevitable task just a little bit longer? :grinning_face_with_smiling_eyes:

And thanks for the lesson on translating themes, will look into that too to improve it!

Obviously, you’ll want to fix your server access issue. :slight_smile:

Meanwhile, activating a different theme and then reactivating this theme will likely cause Ghost to re-read the translation files.

1 Like

Oh, then I maaay be fine as my noobish way of “developing” currently seriously is to write locally, re-zip, re-upload, check the result. Rinse and repeat :joy:
A local instance or some docker solution is on the task list as well :slight_smile: Thanks Cathy, much appreciated!

Local development on a local install is SUCH a skill up, in terms of being able to see changes FAST. Highly recommended. If you’re on Windows, use either Docker, or else WSL.

1 Like