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.
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
admin
and 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?
I get this:
Warning: require_once(/home/vol12/byethost31.com/b31_13280693/tuankiet-gp.byethost31.com/htdocs/gp-includes/backpress/class.bp-log.php) [function.require-once]: failed to open stream: No such file or directory in /home/vol12/byethost31.com/b31_13280693/tuankiet-gp.byethost31.com/htdocs/gp-settings.php on line 64
Looks like your missing files. Check if you’re download was complete and that all thise files got uploaded to the server.
Thanks.
But there is another problem. I can’t run SSH so I can’t run add-admin.php. Is there a workaround?
First look at this comment above https://remkus.devries.frl/how-to-use-glotpress-for-your-translations/#comment-8630 then on this comment thread https://remkus.devries.frl/how-to-use-glotpress-for-your-translations/#comment-7877
Thanks, Remkus, for the great tutorial. I used it to set up http://translate.9seeds.com/ – I also took it one step further and built a quick genesis child theme to look like glotpress so it’s pretty seamless.
Yeah, I should get around doing that as well. Nacin implemented that possibility a few weeks back.
Great post ! I already building my own plugin for WordPress, and this is the coolest solution for my plugin translation.
Side question : Currently I am using the PoEdit to extract my strings for translation, but also extracts and the strings of some sub-folders that are not part of the of the retail plugin version. These folders are part only of the production state. So, can I exclude these folders ? I know that this is not the correct place to ask this question, but I will appriciate if somebody know the answer 🙂
Needs a projects folder and needs gp-includes/backpress folder with backpress in it – http://backpress.org/ – since it refers to the “BP_Log” class in it.
Also there is no indication of file and folder structure for the pot, po and mo files to go into.
It doesn’t need those folders because the po/mo files are imported and exported out of the database.
gp-settings.php line 64:
require_once( BACKPRESS_PATH . ‘class.bp-log.php’ );
the required file has the BP_Log class
(maybe point me to a place for asking user question about glottpress?)
Is there a chance to have some thing like a child-translation, like child-theme in WordPress?
We have English as the root language and there are seeral different German translations.
German formal (100% translated)
German informal (25% different from formal )
The best user experience for German-informal users would be to present German formal if there is no translation.
can a language inherit from an others than the root language?
I don’t think child-like translations are the solutions, but I believe it’s actually already possible to have a formal and informal version of any language. You can head over to WordPress Polyglots and post the question.
Hello,
My wordpress website is reside in subdomain news.mysite.com
– I have downloaded the latest version of GlotPress.
– Created .htaccess file with content mentioned above.
– Renamed gp-config-sample.php to gp-config.php.
– Changed database name (same database which is used by my wordpress).
– Database user and password.
– Uncommented two special lines in gp-config.php which you have mentioned above.
Everything is almost done.
Now tell me where I have to upload all glotpress files in order to proceed with installation?
Can I upload all files to same folder where my wordpress files are exist?
No, you need to put in a subdomain; for instance translate.mysite.com
Thank you for your reply. I did as you said. I have put glotpress files in gp.mysite.com while my wordpress site is at news.mysite.com. When I visit the site url e.g gp.mysite.com then no installation process is starting. Your any help will be highly appreciated regarding this.
Still waiting for your kind response. Here is my site http://gp.haroonyousuf.net/install.php there is no installation screen when I try to visit the site except a white blank page.
I have no idea why you’re seeing a white page, but I am wondering if you have edited the gp-config.php file according to this tutorial. The database connection data should be the same as your WordPress site.
I have started from the beginning as mentioned at
http://9seeds.com/tech/plugin-translations-using-glotpress/
There he has installed first glotpress on a subdomain and then wordpress in a folder named wp.
But result is same.
you can check my both sites.
news.haroonyousuf.net – GlotPress
news.haroonyousuf.net/wp – WordPress
Where wordpress is starting installation procedure but glotpress is not.
First install WordPress. Then use the db credentials you used for WP for GP and follow this tutorial to the letter. That’s all I can say.
I think I am missing to execute the add-admin.php script to create admin user. Is there any other way to create admin user for glotpress without SSH access?
No, you need to install a WordPress instance first and no, there’s no other way than via SSH.
What about the table prefix? Should be same? while both glotpress and wordpress will share same database.
I uploaded the files on the host. I filled in the gp-config.php with the data for the connection to the database. When you access the link, where I uploaded files. gives me a white page … What can I do here? Thanks nice.
White pages usually indicate an error inside the PHP file …
After a long time I have enabled SSH. I have tried to run script (php add-admin.php) via PuTTY SSH login but it is failed. I want to send you PuTTY snapshot. How can I post it over here?
First I run script as:
# php /add-admin.php
It says:
Status: 404 not found
Content-type: text/html
No input file specified.
Then I tired this:
# php add-admin.php haroonyousuf
It says:
Status: 500 Internal Server Error
Content-type: text/html
I can send you PuTTY snapshot if you want to see.
Are you inside the scripts folder?
yes. I have navigated to specified folder and run the script as mentioned above.
then I don’t know what to tell you. That should work if you’re on a server that supports PHP. Sorry.
My server is Bluehost. I have activated SSH. PuTTY is working fine. I have navigated to scripts fold via CD command. Run following script.
# php add-admin.php haroonyousuf
The error message is:
Status: 500 Internal Server Error
Content-type: text/html
Is this just because of I am trying the script via ROOT # prompt?
Should I run script through $ prompt?
What I usually do.
– Download glotpress and extract files. (https://glotpress.trac.wordpress.org/browser/trunk)
– The folder TRUNK contains all glotpress files.
– Make .htaccess file as mention above.
– Rename gp-config-sample.php to gp-config.php.
– Edit gp-config.php, put database, user and password.
– Uncomment following lines
define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
define(‘CUSTOM_USER_META_TABLE’, ‘wp_usermeta’);
– Make subdomain e.g gp.mysite.com
– Put all glotpress files including .htaccess and gp-config.php to my subdomain folder gp.
– Access SSH via PuTTY.
– Navigate to scripts folder.
– Run script # php add-admin.php username
Error:
Status: 500 Internal Server Error
Content-type: text/html
When I access gp.mysite.com, this shows only a blank white page.
Perhaps this is problem due to folder structure. Is there any special folder structure which I have to follow?
For example:
First I should make Backpress folder then put all Glotpress files inside Backpress folder.
What is the minimum php version required by Glotpress?
My server supports
php 5.2
php 5.2 (single php.ini)
php 5.2 (FastCGI)
php 5.4
php 5.4 (single php.ini)
php 5.4 (FastCGI)
A white screen indicates a PHP error. Could also be that you’re using the wrong folder structure. Sorry, too many unknown variables for me to properly help you.
So, what will be the correct folder structure for glotpress files?
I have created subdomain gp.mysite.com for Glotpress.
Which folder structure is ok for Glotpress
/public_html/gp/
/public_html/Backpress/gp/
Where to put Glotpress files?
You need to put everything relative from root. Don’t put stuff in subfolders. See this screenshot as an example: http://i.remk.us//q6/yq05my0ysw8k8.png
As you mention before I need to put glotpress in a subdomain; for instance gp.mysite.com
When I create subdomain this action creates a folder at /public_html/gp
I am puting all glotpress files in gp folder because my site’s root /public_html/ has another site.
Well, in that case your root of the subdomain site is the
/gp/
folder. Then look at my screenshot and make it so 🙂 If that doesn’t do the trick I can’t help you.I have downloaded Glotpress from https://glotpress.trac.wordpress.org/browser/trunk
The files and folders should be same as you provide me structure. I can not find backpress folder and its 3 files inside gp-includes folder. How to have these files.
You have to have your SVN tool download SVN externals as well since BackPress is set up as an SVN External inside the GlotPress project. I’m using the Versions app and it does that automagically for me.
May I have link for SVN tool.
Is this correct link? for the tool you said.
http://tortoisesvn.net/downloads.html
PuTTY allow me to execute the svn command line:
svn co http://svn.automattic.com/backpress/trunk backpress
But this command is fetching more files than you have mentioned at http://i.remk.us//q6/yq05my0ysw8k8.png
The all mistake were the missing files and folder Backpress. Finally Rohingya Glotpress site is online.
http://gp.haroonyousuf.net/
Thank you for your kind support.
GP is working fine except the import .csv file to glossary specially the uni code characters. I am following these steps:
1. Exporting glossary .cvs format file in order to have file format which is opening in excel sheet which contains eng, locale, pos and description columns.
2. Copying translations to respective columns.
3. Saving in same format.
4. Importing the file to GP.
Result:
All English words and translations are importing to glossary except words containing the characters like á é ú í.
Once I import my all glossary to the GP then my translation team will get benefit when they will be localizing WordPress. Any help will be highly appreciated regarding this. Thank you.
The only thing I can think of is that your
.csv
file does not have the proper encoding, but the better place to for this is at Trac for GlotPress.Thank you for the link https://glotpress.trac.wordpress.org/newticket
Is there any user interface to check GP version?
Nope
Hm, I seem to get this error when I try to install:
“>>>>>> Specified key was too long; max key length is 1000 bytes”
Any help?
Late in the party, installed it for my projects/products 😀
http://translate.wedevs.com/projects
Thank you for great post. I’ve been looking for resources of GlotPress on its homepage but all I see is just blog posts with updates. This tutorial helps me a lot to start with it. Thanks!
Hello there,
I used Ultimatum Theme and the WPBakery Visual Composer & qTranslate-X to translate the site I am working on so far the translations are fine since I used the facilities that the plugin offers in the Visual composer editor. However the website´s footer became a real challenge because it is build-in the ultimatum child theme template and it seems that WPBakery Visual Composer & qTranslate-X does not translate the template. My question is does GlotPress helps on this matter? Any tutorial or suggestions on this topic? I would very much appreciate it.
Best regards
Mailin
GlotPress just allows you to manage translations. That’s it.
One of the lines in gp-settings.php near the top is:
require_once( $GP_PATH . GP_INC . ‘system.php’ );
To get it to work in WinXP and XAMPP 1.7.3 (PHP 5.3.1), I had to replace all back slashes to forward slashes in the GP_PATH constant.
I replaced the said line with the following:
$path_base = str_replace(“\\”,’/’,GP_PATH);
require_once( $path_base_inc . ‘system.php’ );
and then then replaced the rest of the “GP_PATH” with “$path_base” to get it to work.
This tutorial is now quite dated. GlotPress is now available as WordPress plugin. This obviously makes installing GlotPress a walk in the park now.