How to set up a multi-language and collaborative wordpress blog

A multi-language and collaborative blog

When I decided to write a blog with WordPress, I had some difficulties choosing to write in French or in English and I would something collaborative.
I decided to begin in English because I thought I would have more visitors and it would be a good writing exercise.

After some days and searches about French blogs, I figured out that there were a lot of French blogs without English translations. Some argue they wanted to keep a French community and others because they don’t have knowledge to write in English.

Besides these reasons, I found some bad quality articles and I wanted to improve that.

So, it was finally decided! I’ll write in both French and English.
I know I won’t be able to write in both languages, and I’ll make a lot of errors in English.

Addicted to the open source philosophy, I found a solution which is to put my articles on a collaborative platform such as GitHub and allow pull requests from people to improve my articles. On top of that, my articles could be easily translated in other languages.

Here are two plugins I found to setup a collaborative and multi-language blog.

It’s not a tutorial to learn how to use these plugins. There’re plenty of tutorial on the web.

Multi language: Polylang

The first step is to install a plugin to allow to redact in several languages. I chose Polylang because it’s easy to install and doesn’t perform persistent changes.

Collaborative: WordPress Github Sync

GitHub is a good platform to share our code, and it’s the platform I chose.
After some searches about a plugin which allows to export and import from GitHub, I found WordPress Github Sync.
It’s also easy to install and it’s very simple to use.

Merge these two plugins

I wasn’t entirely satisfied when I began to use them. Individually, it’s perfect, but there’re some inconveniences when you try to export to GitHub the same article written in French and in English.
By default, WordPress GitHub Sync exports as Y-m-d-article_name. The problem is you have to look at the article name to know which language is. I wanted something like lang-article_name, the date isn’t important for me.

I decided to modify the GitHub plugins (which can be found here). It exports as lang-article_name by parsing the permalink (supposed to be in the form http://domain/lang/article_name).
I added a get_lang method into the post.php file and changed the github_filename method.

The result can be found on my GitHub: dannywillems, and my articles in this repository

How to set up a mobile build server: step 3

  1. Introduction
  2. Server-side and client-side: (Optional) Create and configure an user on the build server
  3. Server-side: Install and configure the Android SDK
  4. Server-side: Install and configure cordova/ionic
  5. Client-side: Automate the build process

Server-side: Install and configure cordova/ionic

This step will be very short. We would like to install globally cordova and/or ionic without root privileges. By default, we need to use sudo with npm install -g (to install globally).
We can avoid these root command by changing the directory where the npm packages are installed.

Each command is executed on the server

Change npm packages installation directory

The new directory will be in your home and called .npm-packages. Create the directory and change the npm prefix by using

mkdir -p ~/.npm-packages
npm config set prefix "~/.npm-packages"

The executable files like cordova and ionic will now be in ~/.npm-packages/bin. We need to add this directory to your PATH to be able to use directly the command.

echo "export PATH=$PATH:~/.npm-packages/bin" >> ~/.${SHELL##*/}rc

You need to reload your shell configuration. You can do it by closing and reopening your terminal or by using the command

source ~/.${SHELL##*/}rc

Before continuing, check you have the directory ~/.npm-packages/bin in your PATH with

echo $PATH

Install cordova and ionic without root privileges

Now, we can install cordova and/or ionic. Here, we will install only cordova.

npm install -g cordova

What’s next?

It’s time to write our build script.

Go to the last part (coming soon). I’m working on several projects now, I don’t have time to write this last part.

Script

You can download it here.