Skip to content

Latest commit

 

History

History
55 lines (28 loc) · 1.74 KB

README.textile

File metadata and controls

55 lines (28 loc) · 1.74 KB

What it is

An internationalization / localization plugin for Jekyll. This is useful if you want to translate your site into multiple languages.

Getting Started

To get started, put localize.rb in your _plugins folder.

Add a translations folder to your project with files named en.yaml, es.yaml, etc.

Put these in your translation files:

global.body: "Some text goes here"

Put these in your Liquid templates:

{% localize global.body %}

The language in _config.yaml will be used when you build.

See the example directory for a working example.

Defaults

You can also (optionally) have a file in your translations directory called defaults.yaml. This file includes translations that are used if a translation is not provided in the current language. This is useful for things like proper names, names of languages, or whatever makes sense in your project.

If a translation is not provided in either the translation file or the defaults an empty string is used.

RTL

You can put rtl: true in your _config.yaml. The {% rtl %} tag will output the current setting. You could use this in a number of ways, such as conditionally loading an RTL stylesheet.

Bonus

You can refer to variables in your front matter like this:

Translation File:

cavies.title: "My Cavies"

Front Matter:

title: cavies.title

Liquid Template:

{% page.title %}

Who uses it?

I made this project for LearnLayout. Let me know if you use it!

License

MIT