Skip to content

How to: Setup for Translators

Florentin Raud edited this page May 1, 2014 · 2 revisions

Public

This documentation aim to help people who wants to translate the Open Company Initiative web pages.
In this document we assume that you don't have commit access and will work in a fork.

Jekyll

You need a platform supported by jekyll
$ gem install jekyll

Setup

Fork the project on github.
Then clone the project locally.
$ git clone https://github.com/<your name here>/www.opencompany.org.git

Set the open company repository as a remote to be able to pull the latest changes.
$ git remote add FromOpencompany https://github.com/opencompany/opencompany.github.io.git

Make sure your setup work before doing any changes.
$ cd www.opencompany.org
$ jekyll serve

We advise you to work in a separate branch, eg. hindi for a translation to Hindi.
$ git checkout -b <insert the language name here>

Prerequisite

We use a translation framework that comes as a plugin to jekyll, namely jekyll-multiple-languages-plugin
You will need to know the 2 letters string for the language you are translating to.

There is a standart called ISO 639-1, it can be found on wikipedia and [other places](list http://reference.sitepoint.com/html/lang-codes)
In the case of the Philippines, Tagalog's letters would be "tl", for our previous exemple it would be "hi" for hindi, etc.

Skeleton

The plugin requires a specific directory layouts to find the translated template.
This plugin also requires a yaml file with the translated string.

The best way is to start with a copy of the English version.
$ cp -R _i18n/en/ _i18n/<ISO 639-1 2 letters code>/
$ cp _i18n/en.yml to _i18n/<ISO 639-1 2 letters code>.yml

In our hindi exemple, that would be the following:
$ cp -R _i18n/en/ _i18n/hi/
$ cp _i18n/en.yml to _i18n/hi.yml

Finally, you will also need to add the language to the index of languages supported.
Edit the _config.yaml to add your ISO 639-1 2 letters code to the languages key.

To continue with our exemple, the line would look something like that:
languages: ["en", "fr", "hi"]
Note: English ("en") needs to remain the first item in the array to remain the default language

Translation

The first part to translate is the yaml file.
This is where the navigation and the page name are stored.

Then come the template files. Those are the pages that make most of the information available on the website. Finally, the blog posts will need translation.

Note: It is better to have something than nothing, keep an English version when you cannot translate.
It is also beneficial for git, as it cannot track empty folder.

Pull request

To make sure you are translating the latest.
Pull before you do a push and compare the changes to your branch.
$ git pull FromOpencompany
$ git diff master..<insert here language name>
$ git diff master...<insert here language name>

Once ready push it your own repo
$ git push origin
You can do the pull request from the github interface.
It should be picked up from the team.

Note: There could be some time between the merge of your pull request and the content update on the site That said, it should not be days.