Translation of Navigation Items

  • What version of Ghost are you using?
    Ghost 2.23

Hello everyone,

I am trying to build a multilingual site however I got stuck at making translations for Navigation Items, such as the {{label}} helper. I am following this documentation - https://ghost.org/tutorials/multi-language-content/ however I can’t seem to find how to make the nav labels translatable.

Is there an elegant way to do this? Where the user would be able to create different labels in the admin Design section and translations would be added to the corresponding locales json files? Is it possible to maybe achieve this with the {{t}} helper?

Thank you in advance.

Max

(This thread maybe belongs in the Themes section of the forum instead.) I was also unable to achieve this, and as far as I could tell it was not possible.

I filed a bug report to track the issue:
https://github.com/TryGhost/Ghost/issues/11444

Confusingly, the tutorial implies that you need separate templates for each language, while the docs explain that there’s a translate helper which adjusts text strings based on the language setting of the site. It’s not obvious what the difference is: locale files only show the language set in the site settings and can’t adjust the language based on the current post’s language, whereas templates can access tag data.

In other words, the translate helper, {{t}}, is useless for multi-lang sites, and is only useful for templates themselves to be useful for websites which exist in any one language supported by the locale files.

There is this prior forum post on the topic: https://forum.ghost.org/t/blog-localisation-via-templates-navigation-and-tags/3514

While you can pass some data up to parent templates through contentFor block helpers—you can’t dynamically translate site data like navigation links based on that. It seems like the only way is to hardcode the navigation links in your theme in two languages and completely disregard the site navigation data, a very poor experience for clients.

Hi @heyakyra and @maxiR8. Thanks for bringing this to our attention, we’ve spent some time to improve the tutorial to hopefully clear up the differences between the language features we have within Ghost:
https://ghost.org/tutorials/multi-language-content/

With regards to translating navigation labels I’d be inclined to either hard code them into the theme or use a tool like WeGlot which is designed for translating entire sites into multiple languages. A site that needs to cater for multiple languages can become extremely complex, regardless of the tooling you use, so I’d recommend seeking out tools like WeGlot which will hopefully help remove some of the overhead.

Hi I have spent some hours on sorting out the language support, the tutorial is very good and helpful, and it also reminded us to modify the html lang label. I supposed the translate helper will use the lang config from there and I am very happy to hack the multi-language implementation. But finally I found out that, translate helper is not reading that config at all, isn’t it? Instead, it’s using the language specified in admin interface.

This is a bit regret… As locales should be a thing that controllable from frontend… If we have this control possibility, complex will be reduced, to build a multiple language site will be a very ease case.

EDIT: just found that this topic has been discussed long time ago in 2018. :frowning: Please reconsider this, after two years of time passed

I think you’re possibly getting the translate helper mixed up with handling multiple languages on a single site. The translate helper is designed to make a theme be compatible with multiple languages. The language tutorial is showing how to build a Ghost site with multiple languages at the same time, the translate helper would not be as useful in that case.

This topic was started in June 2019, as shown in the initial post, not sure where you are referencing this :thinking:

Hi. Yeah, I did mixed up that. the helper will translate the text based on the backend 's setting, so i am just wish that, it could be a bit more flexible for it to allow the possibility of controlling translate in frontend. That is an amazing functionality.

For date confusing, sorry didnt explain well. there is another post that priories to this one mentioned by second floor, Blog localisation via templates & navigation and tags, which is happened in 2018 and discussed this feature in detail, and gave an conclusion that this wont be considered at that moment.

1 Like