Improvements in GNOME Website - Weekly Report 2

Late report detected. Sorry for this!

I wrote this originally as a post for my blog:

It’s been a week after my first weekly report, and it is time to release a new one! Right now I’m finishing the pending tasks of WPPO, a plugin that makes WordPress websites translatable using the same existing infrastructure that exists and is done for GNOME software.

Last week I wrote about the two main missing things in WPPO, and I’m very happy to say that I got really nice improvements in both of the items:

URL handling

The base of a website that have versions in multiple languages is a URL system that understands and create permalinks to each language of all the pages. WordPress comes with a WP Rewrite API that allows managing the website link rules.

In our scenario, we need links like and So, the language is much more like a global prefix to all link structures other than new rules in the Rewrite API.

I checked some existing plugins for WordPress that try to do the same language prefix in URLs (polyglot2, qtranslate and transposh are on the list), and I didn’t think their implementations were really good. Basically those plugins duplicate all the existing rules and add a regex to understand the language prefix in the beginning of each single rule.

The problem with this method is that it duplicates all the rules and ends up being an ugly workaround to something that should come before the rewrite rules (as a suffix of the home url).

Then, to create the URL handling for WPPO, I replaced REQUEST_URI global variable with a version that doesn’t contain the language part before WordPress checks for it. This move avoids the plugin to have to hack around all rewrite rules. WP will then blindly feel fine with a fake permalink that looks like default. To finish I added some filters around redirects and url creations to make everything work as expected. Code is this here.

Administration area

Now website maintainers have an area inside WordPress admin to check for translation statuses, changes in pages and posts that weren’t sent to translating yet (with links to diff compare between old and new changes), options to activate and deactivate languages and regenerate POT file.

For this next week I’m planning to to finish all the details around WPPO, make some more tests, polish the administration area, and put a test site online. Then I start my task #2: Create an Projects/Apps section in website.

See you in Summary #3 :)

Vinicius Depizzol <vdepizzol gmail com>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]