Middleman i18n: language files (YML) don't seem to be recognised

26 Views Asked by At

I have a working Middleman v4 website. Now I'd like to add a second language:

activate :i18n, :langs => [:de, :en]

I have created the following files:

/source/locales/de.yml:

---
de:
  hello: "Hallo"

/source/locales/en.yml:

---
en:
  hello: "Hello"

But when using = t(:hello) somewhere in a template, I just get translation missing: de.hello.

I already restarted the server, but no success. I have tried to break the validity of a YML file (just replaced the content with de:::), hoping that Middleman would produce a parsing error or anything like that, but nothing happened (the Terminal continued to display == LiveReloading path: /locales/de.yml).

I wonder whether Middleman doesn't find/parse my locales YML files at all?

1

There are 1 best solutions below

0
Vivek Dhar On

The locals folder needs to be under the root directory and not sources. Reference the structure here: https://middlemanapp.com/basics/directory-structure/