Documentation

Internationalization

Leaves has a basic internationalization functionality integrated.

It translates the default locale at /, and the other locales at /LANG/.

Translated files are generated automatically, from all the files matching locales/LANG.yml.

Here is a short example

index.jade

block content
  h1(data-t="greetings.hi")
  h4(data-t) greetings.bye

locales/en.yml

greetings:
  hi: Hello!
  bye: Goodbye!

locales/fr.yml

greetings:
  hi: Bonjour!
  bye: Au revoir!

will generate the English version at / and the French version at /fr.

dist/index.html:

<h1>Hello!</h1>
<h4>Goodbye!</h4>

dist/fr/index.html:

<h1>Bonjour!</h1>
<h4>Au revoir!</h4>

To set the default language to French, you can run

$ leaves config set i18n.locale fr

For more information, check out the documentation. All the options of static-i18n can be customized in .leavesrc, under the i18n key.