Redesign Your Town

Urban Regeneration in Four European Countries

User Tools

Site Tools


Automatization script for the translate plugin

Hello everyone again. As you may know, recently I've developed a plugin for the wiki. If you don't know what I'm talking about, I suggest you to read it here. The thing is that, as I told you before, I've been working in something more to make use of the plugin. And It's finally done.

Until now, to use the plugin you needed to edit some page and write the translate tag. Something like this:

{{translate>some words here||direction_of_mp3}}

Not so hard, I think. But we are awared that you all are really busy (so we are). And we wanted to help you save more time of editing the page. In consecuence, I've developed a script (a set of computer instructions) that automatice all the work. Now you can concentrate more in expanding the glossaries while my program does the dirty work.

So, what does It exactly do ?. Well, in fact It have two parts:

-The wikiventario script: This one read all the glossarie pages searching the words with their recorded translations (exactly the information the plugin needs) and index it in simple text file. This mean that the script needed to know the format of how the glossaries were stored. Not sutch a big deal because they all use the same format, but still hard to do.

-The wikitranslate script: This one takes the text file created by the previous one and search in the wiki for the indexed words. When It finds one, It's replaced with the apropiate translate tag. That was the tough part. In the wiki there is many different tags whith different formats. And you can't replace the words everywhere. For example, inside the direction of a link. So the script had to understand all that formats and replace only in the adecuate parts. It took a lot of work and headache to accomplish it. At the end, I think it works really well. Also, a log of all the changes is created and a backup of the files is done. All fully professional (more or less).

So that's the idea: You fill in the glossaries and, periodically, the scripts are executed by us. The index is updated and the words replaced without further work. Really easy and time-saving.

To clarify things, I've recorded a video showing the execution of the script:

This is all. The code of both scripts is published under a free software license (so you are free to estudy, modify and use it) and can be found here: If you find some bug or malfunctioning, please report it (I will register an email direction for that soon).

For now, this is all the work I've planned to do for the wiki (at least, on the developing side). Now It's your turn to colaborate expanding the wiki and making it bigger. Also, if you have any suggestion of idea for new cool features, let me know it. Any feedback is welcome. Maybe, in the future, I'll develope. In any case, I'll keep you informed.

Anyway, goodbye for the moment. See you soon.

by Ángel García Jiménez


wiki_plugin_plus_script.txt · Last modified: 2014/10/15 22:39 by antony