Skip to content

incompl/jekyll-localize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple plugin to internationalize / localize Jekyll sites.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages