Ghost Post Translation - Multi Language content

Hi, I am looking for this article https://ghost.org/tutorials/multi-language-content/, which is referenced in several discussions of this forum related to hosting Multi-language content on Ghost blog. The tutorial link is not found now, is it intentional, like is there a new reference I can refer for setting up Multi-language content?

References:

  1. Multi-language blog with a multi-language theme
  2. Blog Translation and Language Activation

Please suggest.

Thanks.

I am looking for this link too.
It was mentioned here as well: Ghost Themes - Dynamic URLs & Routing

A new tutorial how to build a post in multiple languages would be really appreciated.

I am one step ahead.
I extended the routes.yaml of my theme with the following code:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: 'tag:-hash-de'
  /de/:
    permalink: /de/{slug}/
    template: index-de
    filter: 'tag:hash-de'

Also I created an internal Hashtag, called “#de”. Now I have two separated areas with English posts and /de/ with German posts.
The only thing I don’t know is, how I can tell the theme that it should use my German language file when browsing through /de/.

Any suggestions?

Ya, I am stuck at the same point - how to tell the theme, which language file to pick. I thought it would work based on html lang attribute, but it didn’t. Html lang attribute is changing appropriately.

abc.com picks en (Publication lang) by default, but abc.com/de is also picking en only, instead of de (ideally it should be picking de lang file from the locales folder instead of en).

Am I missing anything? Please suggest.

There are two distinct concepts here:

  1. Building a translatable theme (only one language at a time)
  2. Building a site with multi-language content

Our previous tutorial conflated these concepts, which caused a lot of confusion for developers on what’s already a really complex topic. We are currently working on writing new tutorials for both of these concepts.

I think the key thing that trips people up, which I think is what’s happening for @kmanojkumar, is that multi-language sites don’t use json language files. They only apply to translatable themes using a single language (option #1).

To support multiple languages in a single publication (option #2), you need to use separate templates (index.hbs vs index-de.hbs), as well as a mix of the #has, #match, and #block helper.

If you share more about what you’re trying to do, I can provide some guidance/examples.

Thanks for clarifying @RyanF.

I am working towards Option #2. Can you guide on how Multi-language content can be implemented? Post content I managed to translate using Internal Tags and Collections within routes.yaml. How to translate theme content now?

Like for example, “Published with Ghost” in abc.com/ 's footer should be translated to “Publicado con Ghost” in abc.com/es.

Thanks.

Translating these other parts of the site is trickier :grimacing:

You’ll want to create a block where you want that text to appear. In this case, I’ll use default.hbs as an example:

<div><a href="https://ghost.org/" target="_blank" rel="noopener">{{{block "pub-tag"}}}</a></div>

Then, in index.hbs, you’d add this anywhere in the file:

{{#contentFor "pub-tag"}}Published by Ghost{{/contentFor}}

And in index-es.hbs:

{{#contentFor "pub-tag"}}Publicado con Ghost{{/contentFor}}

You’d have to do this for every top-level template file. In post.hbs, you would do this:

{{#has tag="#es"}}
    {{#contentFor "pub-tag"}}Publicado con Ghost{{/contentFor}}
{{else}}
    {{#contentFor "pub-tag"}}Published by Ghost{{/contentFor}}
{{/has}}

Here’s a reference to the block helper in the docs: Ghost Handlebars Theme Helpers: block & contentFor

Let me know if that’s what you were looking for!

Puh Thanks for all the explanations @RyanF. In my case this is too much and will blow up the theme a lot.
Maybe you guys can make that things easier in an upcoming version of Ghost. :slight_smile: