A multilingual approach for Jekyll/Octopress sites
A detailed look into how this plugin works can be found in this blog post.
- Supports both multilingual and single language posts/pages
- Supports translation of static text
- Supports conversion of pages generated by third-party plugins (Note: might not work in every case)
- Supports ability to indicate a post was written in a particular language
put the two Ruby files in your project's _plugins/
folder.
This plugin might not work with every third-party plugin out there. You will need to adapt them to support multiple languages.
Add a languages
array to your _config.yml
# The first language is the default language of your site
languages: ['en', 'de']
This plugin supports two kinds of posts/pages:
- Single-language (i.e. only written in a particular language, but still being shown in other languages)
- multilingual (i.e. one post/page per language.)
Single-language posts/pages have a primary language that is indicated by a tag in the post's/page's front-matter:
language: en
Multilingual posts/pages define their language in the filename (any language tag in the front-matter is ignored):
2014-08-04-foo-bar.en.md (for posts)
foo-bar.en.md for pages
Of course this works with .md
, .markdown
and .html
file extensions.
File lacking any of the above are considered to be written in the default language.
Full credit should go to the Jekyll Multiple Languages Plugin. The translation code is heavily based on their work (and a copy for the most part).
Feel free to ask for help, if you encounter any issues.