Locale not being preserved for articles for language other than English

Hey,

Here is my config:

languages = [:en, :es, :ja]
activate :i18n, :path => "/:locale/", langs: languages, mount_at_root: :en

locales = languages
locales.each_with_index do | locale, index |
  # Blog
  activate :blog do | blog |
    # # Locale path: first locale is mounted at root
    path = index > 0 ? "#{locale}/" : ""
    blog.name      = "#{locale}"

    # This will add a prefix to all links, template references and source paths
    # blog.prefix = "blog"

    # {slug} is from frontmatter

    blog.permalink = "#{path}{slug}.html"
    blog.sources = "articles/{title}/#{locale}.html" # Matcher for blog source files
    blog.layout = "article"

    # # Pagination
    # blog.paginate  = true
    # blog.page_link = "page/{num}"
    # blog.per_page  = 15

    # # Calendar
    # blog.calendar_template = "calendar.html"
    # # blog.year_link         = "#{path}blog/{year}.html"
    # # blog.month_link        = "#{path}blog/{year}/{month}.html"
    # # blog.day_link          = "#{path}blog/{year}/{month}/{day}.html"

    # blog.summary_separator = /(READMORE)/
    # blog.summary_length = 250

    # # Tags
    blog.tag_template = "tag.html"
    blog.taglink      = "#{path}tags/{tag}.html"
    

    blog.custom_collections = {
      category: {
        link: '{category}.html',
        template: '/category.html'
      }
    }
  end
end

My article.html.haml template looks something like this (I simplified it for sake of this post):

= wrap_layout :layout do
  - content_for :head do
    = partial "layouts/meta-article"
  .container
    .article-content
       = yield # show content of the article itself

I’ve added in layout.html.haml, %html{:lang => "#{I18n.locale}"} for debugging so that I can double check what locale the site is on. Now:

  • when I am at root / I can correctly see en as locale, so that’s correct
  • when I am at /ja/, I can correctly see ja as locale, so that’s correct too
  • however, when I am /ja/path-to-my-article/, or any other path to an article written in a language other than English, I can see en as locale, so that’s not correct

Can anybody point me which part of

Found this, hope it helps