This tutorial is now quite dated. GlotPress is now available as WordPress plugin. This obviously makes installing GlotPress a walk in the park now.
From the first day I started using GlotPress for translating WordPress into Dutch and Frisian, I fell in love with how GlotPress facilitates the actual process of translating. Before GlotPress I relied on PoEdit, but I felt very little love for how PoEdit worked. GlotPress on the other hand, as a webtool, makes translating software as/with a team an actual possibility. For this very reason alone I installed my own installation about a year ago.
GlotPress is based on BackPress, but it is still in early stages of development. Stable enough to provide us with a platform for teams to translate, but it’s certainly not a finished product. As a translation expert / moderator on the StudioPress forums I installed a GlotPress installation for translating Genesis, and when Joost de Valk from Yoast.com mentioned to me he was working on making his WordPress SEO Plugin fully translated, I suggested to him he’d start using GlotPress as well. A few moments later I had installed Joost a GlotPress installation for Yoast.com.
So, on to the topic at hand. How to use GlotPress for your translations. Follow the following steps and you should be good to go.
Installing GlotPress
If you know how to install WordPress then you know how to install GlotPress. The exception being that GlotPress doesn’t have a fancy installer. You need to find the latest version of GlotPress on in SVN trunk. After you have uploaded all the files you need to edit gp-config-sample.php
to gp-config.php
and edit the database data. Upload it back to your GlotPress folder and run the installation script by visiting the site url. The only extra thing you have to do is add a .htaccess
file with the following content:
# BEGIN GlotPress .
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END GlotPress
Configuring GlotPress
By default GlotPress will allow you to login with username admin
and password a
, but as you can imagine, this is not the safest solution. Because GlotPress is based on BackPress it does not have a user interface. Fortunately, there is a solution for this. Additionally, since you’re using GlotPress to provide a platform for people to contribute in translating your software, you will also need a way for people to register. We can solve both those issues by creating a sub-folder in which you’ll install a WordPress installation. Mind you, the need to share the same database. Why you ask? Well, when you check the gp-config.php
file you have just created you’ll notice that somewhere down the bottom of that file the following code:
/**
* Custom users and usermate tables for integration with WordPress user system
*
* You might want to delet your current permissions, since they will point to different
* users in the custom table. You can use `php scripts/wipe-permissions.php` for that.
*
* If you start with fresh permissions, you can admins via `php scripts/add-admin.php`
*/
// define('CUSTOM_USER_TABLE', 'wp_users');
// define('CUSTOM_USER_META_TABLE', 'wp_usermeta');
All you need to do is uncomment the first define and change to wp_users to whatever database prefix you’ve decided to use for your WordPress installation. This makes GlotPress use the users table of your WordPress installation, and you’ll notice you can log into GlotPress immediately after you’ve uploaded gp-config.php
again.
Note, though the default WordPress registration function will work, it’s much cooler to use Gravity Forms and their User Registration plugin to do your registering. That’s what I used for StudioPress‘ and Yoast’s.
Create an admin
You can log in now, but you can’t actually create projects just yet. You need to do one more thing and you’ll need SSH access to your GlotPress installation for that. Log-in via ssh on your server, navigate to the /scripts
folder and execute the script via
$ php /add-admin.php
. So if remkus
is the username you’re using the script would look like this:
$ php add-admin.php remkus
. This will turn the specified user into the admin. You can now create projects, create sub-projects, translation sets, import .pot
files and import existing .po files for current translations.
Create Validators
GlotPress works with admin, validators and translator roles. You’ve already made yourself an admin, and everyone who registered via your WordPress site is automatically made a translator. The only thing left for you to do is upgrade the proper usernames to the validator role. You can do this in the admin menu Permissions per project. This will allow for validators to approve, reject and edit strings. Just the thing you want as you’re not going to be able to understand every single language you’re going to have in there 😉
Tips for creating a solid translation set
Working with GlotPress is very easy. You can simply double click on the string you’d like to translate and either manually translate or see what the Google Translate option does. Either way, you have to make sure that the translations you create use the same code / HTML in the translated version of the strings as the original. As a validotor you can check out the Warnings listing. This will show you all the strings that have errors in them. You will want to remove / edit those first before you start bulk approve strings.
When you create a project in GlotPress you have the option to add a Source file URL. This usually being the SVN repo link. In Joost’s WordPress SEO plugin’s case you’ll end with this link: http://plugins.trac.wordpress.org/browser/wordpress-seo/trunk/%file%#L%line%
. By adding this url you add a reference to the translation strings. You can then click on the reference link and see where in the code the translation string is used.
There will be bugs
As you probably have gathered, installing GlotPress is not for you n00bs out there. You need to be familiar with SVN, SSH, PHP to name but a few acronyms :). Also, GlotPress is not a finished product, so there will be bugs. Find one? Please report them to GlotPress trac.
Need more?
If there’s a need for more tips in the shape of a screen-cast, just let me know in the comments.
Leave a Reply