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:
[php]/**
* 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’);[/php]
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
[code]$ php /add-admin.php[/code]
. So if remkusis the username you’re using the script would look like this:
[code]$ php add-admin.php remkus[/code]
. 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.
Thanks for share! I was looking for some way to change the admin login quite for a while. Why such things still aren’t available
Glad you found it useful Diana
Super useful! Thanks for writing this Remkus
Do you know thr plug-in codestyling-localization? It’s very convenient for translating plug-ins.
I do, yes. But that’s not a plugin I think you can compare to GlotPress. Closer to how PoEdit works imo.
Thanks for the tutorial, and for the research behind it, Remkus!
I’m setting something like this up for myself, and your instructions are pretty straightforward. I should point out, though, that the add-admin.php script is inside of the scripts subdirectory, which you’ll need to know when you run it from the command line.
Now I just have to figure out a workflow for pulling my latest dev versions from Github….
You’re welcome Boone. Glad I could help you out for a change
Thank you Remkus for the precious help!
Could you pelase edit the text above to let know that add-admin.php script is inside of the scripts subdirectory as mentioned by Boone.
Thanx again
Just added that bit, thanks!
Great tutorial, did you find a way to include the github projects ?
Thanks for the tutorial, gonna start using this for my plugins/themes translations.
Just a quick tip for lighttp users, here’s the rewrite rule I used for GlotPress:
Thanks for the tut
Is there another way to add an admin, some hosts doesn’t run php-cli?
Not that I’m aware of, but it’s on the radar for version 1.0.
We’re gonna release a all new shiny Swedish community portal for WordPress any day now, We’re gonna use GP to make it easier for Swedish users to create translations together for themes and plugins.
But, creating an admin user creates problems for us as we can’t use cli commands with our host. Is there really no other way to go? Manually in the database? What exactly does the cli command do?
It executes a PHP command on command line level. There’s no way around that. I’m sure your host could do that for you if you explain/ask them?
I know what cli is, but not what this specific command does other than setting an admin (where is this set?). The host can’t help me
Well, it will change a specific user to an superadmin user. I suppose you could also do it via the database, but I’m not sure what all needs to be changed to bypass the cli command. Might be worth a shot hitting up Nikolay on twitter.
Will do, thanks for your answers
It doesn’t do anything else. It just a new row in the permissions table with the appropriate user ID, the action is
adminand the rest are the default values. You can do it via phpmyadmin, too.Sweet, thanks for answering
How does the download work? I just get to the website directory and I cant download the complete thing from there… Then Ill be have to create copies of all the files, right?
You can download GlotPress via the repo: http://svn.glotpress.org/trunk/ with any SVN tool or you can download it as a zip via the trac trunk page: http://glotpress.trac.wordpress.org/browser/trunk
Thanks for this comments, I was picturing myself downloading one by one all the files from the repo. It’d be great if you make it more clear in the post that it’s possible to download a ZIP file.
Thanks again!
Other little thing you should add to the installation is the backpress folder.
Aparently it doesn’t come by default in the package that you can download from:
http://glotpress.trac.wordpress.org/browser/trunk
And it’s totally clear that you need all those files inside “…/gp-includes/backpress/”
So it’s compulsory to download it via svn as they say in:
http://backpress.org/download
Thanks a lot for this clarification! I’m trying for several days to get passed over the 500 error my server was throwing. I admit I didn’t have the time to take a look in the code/requests
@Remkus – thanks for all the info in the article. I strongly believe it will help adding the step that @ionelberdin mentioned.
Hey there,
one little addition to this amazing tutorial – there is an alternative to ssh in your server. You can grant admin right if you are in mysql – just duplicate the one entry and enter your UserID. I did this because I am using my already existing WordPress User Database.
Finally I understood GP and was able to do a successful install. Thanks for sharing
Are you aware of other resources/plugins?
I found this and it’s quite nice to get the gist of a GP plugin: https://github.com/GautamGupta/GlotPress-Plugins
Am wondering about joining both login sessions, so once logged into WP you’re automatically logged into GP. Any hints?
i installed it on localhost and didn’t have to go through the “Add admin” step.
@Manuel, just for the records, what exact entry are you mentioning?