Image Localisation

Starting from version GooTool 0.9.4, GooTool contains a feature to enable translators to automatically generate in-game images using text from the translation wiki. It's not the most user-friendly thing in the world but it should be useful.

To enable this feature, you must first enable Translator Mode from the Advanced menu.

It requires an input directory in which you put l10n_images.xml along with the source graphics. A zip file containing a sample XML file plus source images is available here.

The translations are automatically downloaded from the wiki every time you click Test or Build, so you can see your wiki changes in real-time.

Test Mode

In test mode, you can choose a background colour to test transparency. You can also turn on debugging. This annotates the image as follows:

Test mode does NOT write any images to disk. It only opens a preview window.

Build Mode

In output mode, it will output all the files to the specified directory. NB I do not recommend doing this directly into your World of Goo installation!

Adding new images

You can easily extend it to add more translatable images using the XML file format described below. First make a PNG file of the source image minus all text (Kyle has uploaded source PSD files that will help with many of them). Then add a description of them to the XML file using the format below. If you add definitions for more images, please send me the blank images plus the XML snipped, so I can add them to this master zip file!

When drawing outlined text you should draw the outline first (since it's hollow and the outline stroke goes both inside and outside of the shape outline) and then draw the regular text on top of it in the fill color.

XML file format

The root element is i18n and contains a list of images to generate in the form of process-image nodes.

process-image nodes have a source, specifying the input PNG in your input directory, and a dest, specifying the output filename including path but excluding .png (since the tool will add .de.png etc. depending on the language).

process-image then contains a list of draw or layer images.

Layers can contain other draw/layer instructions, but are processed independently before being written into the target image. The purpose for this is to let you apply a filter to the contents of the layer, without applying that filter to the entire image. If you don't need filters, don't bother with the extra overhead of layers.

The only currently available filter is gaussian-blur, which blurs the layer that has been created at that point.

draw contains a positioning instruction (either fixed-position or fit-to-box) and then a number of actual drawing instructions. The only currently available drawing instruction is text. You can have multiple drawing instructions inside the draw element, which causes them all to inherit the same positioning.

All coordinates are given relative to the source image, where 0,0 is top left. Note that positioning is done before rotation is applied, so use the debug mode to test boxes.

In the table below, "?" means 0 or 1, "*" means 0 to many, "+" means 1 to many, and no symbol means exactly one.

The best way to understand all this is just to look in the sample l10n_images.xml in the zip above.

Element Purpose Attributes Children
i18n Document element process-image*
process-image One particular image to generate source, dest, draw*, layer*
source The input file (text)
dest The stem of the output filename (text)
layer A layer containing other drawing instructions and filters. draw*, gaussian-blur?
gaussian-blur Applies a Gaussian blur filter to the current layer radius Blur radius (none)
draw Something to draw (fixed-position or fit-to-box), text*
fixed-position Specifies to draw at a fixed position x x-coordinate
y y-coordinate
x-justify? left/center/right to justify about this point (default middle)
y-justify? top/middle/bottom to justify about this point (default bottom)
(none)
fit-to-box Specifies to resize drawing to fit within the specified bounding box. x x-coordinate of top left of box
y y-coordinate of top left of box
width width of box
height height of box
x-justify? left/center/right to justify within this box (default middle)
y-justify? top/middle/bottom to justify within this box (default bottom)
allow-grow? If the text is actually smaller, should we make it larger to fit? (Default true).
True: Grow or shrink to fit the box. False: Only shrink if necessary, never grow.
(none)
text Draws text string,font,color,rotation?,arch?
string The ID of the string to draw (e.g. IMG_RESULTS_CONTINUE)
If the string has newlines (pipe |), you can reference specific lines using []
e.g. IMG_IMPALESTICKY_HINT[1] (index starts from 1)
(text)
font The font to draw using name The TTF filename in input directory
size The point size
stretch? The x-stretch to apply (e.g. 2.0 makes it twice as wide, 0.5 half as wide)
outline? The width of the outline to draw (defaults to filling instead of outlining)
(none)
color The color to draw in, in HTML format e.g. #ff0000, optionally followed by a comma and an opacity (alpha) value 0-1 e.g. #ff0000,0.3 (text)
rotation An optional rotation value in degrees. Negative is anticlockwise. (text)
arch Causes the text to arch, as used for chapter intro images. Uses a simple half-sine wave to arch for now.. height The height by which it should arch in the middle
angle The rotational angle difference between the far left and far right character. Example: 45 degrees would mean the far left character is angled -22.5 degrees, the far right is angled 22.5 degrees
(none)