I am developing internationalized ghost theme. And there are certain things that I need to switch depending on current locale. For example, I need to have language switcher in a navigation bar, with highlighted current language.
I wanted to use a custom helper, but it seems that now it’s not possible to add it via experimental Apps-feature like described here GitHub - TryGhost/Ghost: Turn your audience into a business. Publishing, memberships, subscriptions and newsletters.
So are there any options to achieve my goal? Something like {{has locale=“en”}}
Currently the site language is selected by the admin in settings. To allow site visitors to choose it themselves, there are community proposals for multilingual Ghost sites, still waiting for interested people to prepare pull requests, etc. See [i18n] Multi-lingual Content Publishing (Mockups) · Issue #8509 · TryGhost/Ghost.
Maybe the devs can say, but it looks like the {{has}} helper doesn’t include a locale attribute at this moment. Of course I agree it would be a nice addition.
The {{lang}} helper gives the language code: en, fr, etc. If you prefer to get the full words English, Français, etc., a possibility is to use for example a {{t}} translation helper {{t "English"}} in the .hbs theme templates, and lines like the following in the translation files (en.json, fr.json…):
That is the way I am implementing it. But I have a multicountry blog, and one of the countries is bilingual. So I want to have a link in the header to another language site that will be visible only for a particular locale.
Maybe I will find some workaround with translations file.
hey guys, I wonder what if need fully sunchronized two-language blog – should I go with Ghost? I know that I can use third-party tranlsation widgets like Weglot or Localizer, though I would prefer something like WPML in Wordpress or native “cultures” in EnduroJS
From your experienced developer opinion – is it hard to handle issue in Ghost? If I decide to do it – what crucial steps should I undertake? Right now it is just the url handlng that bothers me most, other things like ID + language seems to be not so hard to implement.
@sorokinvj It depends on the different issues. I think that one—multilingual Ghost site—can take time because, in the case of open source, people are busy with many other things, work, family, etc. However, like you, several people have already expressed their interest in contributing to that project.
In my humble opinion, open source works best when, not just one contributor, but multiple people—developers or not—are welcome to contribute ideas, designs, code, testing, etc. The Ghost team usually reviews contributions and gives guidance. So, rather than waiting for someone, those interested in any particular issue can start brainstorming possible solutions, defining the main goals, dividing these into many smaller tasks that people can contribute to, and so on.
Or, for the small tasks, it can be as well like the good old, interesting open source read, A tale of two developers. ;)
It’s worth noting that the Ghost core team is working on internal projects that will make multi-language sites easier. The first stepping stone to this is the “Ghost's Channels - #8 by dsecareanu” project that would enable you to section your site via tag, that would open up the possibility of using #lang tags on posts to separate different languages.
As the above two projects develop we also have plans for improving the UI and allowing customisation to better expose various “collections” of content. The idea being to make Ghost much more powerful and flexible, using tags and private tags to provide site structure.
So, while there is no specific multi-language support planned we’re definitely working on underlying improvements that will lead to multi-lingual sites being easier to work with.
In the meantime, the recommended approach is definitely to run a separate Ghost blog for each language and implementing some JS or very basic (even web-server level) server-side code for the redirects and/or cookies to remember a user’s selected language.
Hi Kevin,
Nice we started to translate our blog and the channels project is exactly what we need.
Any Guestimate for theses features? 2018? 2019?
Thanks