[FrontPage] [TitleIndex] [WordIndex

This is a read-only archived version of wiki.centos.org

Automate Slide Rendering

Here we'll talk about how to automate anaconda's slide images creation in different languages.

1. Introduction

To automate this process we designed the slides in Inkscape and replaced its original texts by markers. These files became in SVG templates. If you want to change slide design, SVG templates is what you need to modify.

SVG templates are paresed by a sed program that reads substitution commands from files. These substitution files contain translations it self. The translations take place inside SVG templates by markers substitution. Each time the sed program parses the SVG template it creates a temporal SVG template copy with the translations, ready to be exported as PNG file. When the PNG file is exported the related SVG template copy is removed, and the loop starts once again until there is no more substitution files to read.

For example, to create the welcome slide for the English(en), Spanish(es), and French(fr) language we apply the following files to the sed program:

and as result we get the following files:

The sed program is called inside a shell script named translate.sh. translate.sh reads recursively the TXT/*/*.sed files and applies the related SVG template to each one. It is the responsable of calling inkscape program to do PNG exports.

2. Try it out your self

If you are concidering to do some slide hack, the following file could help you. It is a recopilation of SVG templates and translations you can use as start point:

If everything is ok, translate.sh output should look like the following:

Background RRGGBBAA: ffffff00
Area 50:50:600:429 exported to 550 x 379 pixels (90 dpi)
Bitmap saved as: PNG/cz/01-centos5-welcome.png
Background RRGGBBAA: ffffff00
Area 50:50:600:429 exported to 550 x 379 pixels (90 dpi)
Bitmap saved as: PNG/cz/02-centos5-donate.png

3. SED Substitution Files

SED substitution files are where you put your translations. They were orgainized inside a two letters (ISO-3166-1) directory under TXT directory.


# Anaconda's slide translation
# Title   : 01-centos5-welcome.png
# Template: 01-centos5-welcome.svg
# Language: English

s/=TITLE=/Welcome to CentOS 5 !/;
s/=TEXT1=/Thanks for installing CentOS./;
s/=TEXT2=/CentOS is an enterprise-class Linux Distribution derived from sources freely provided to the public by a prominent North American Enterprise Linux vendor./;
s/=TEXT3=/CentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. (CentOS mainly changes packages to remove upstream vendor branding and artwork.)/;

3.1. Applying SED substitution files to a SVG template

Actually there is nothing to apply but a name convention, the translate.sh script do the rest.

If you are happy with the slides deisgn, all you need to do is locate the SED translation file in its location and run translate.sh script. For example, if you want to translate 01-centos5-welcome.sed to French, its location is TXT/fr/01-centos5-welcome.sed, but if you want to translate it to German its location is TXT/de/01-centos5-welcome.sed. After you have placed the file translated in its location, you can run translate.sh script to build its PNG translated version.

The following SED subsitution files are immediatly available for you to translate in any language:

01-centos5-welcome.sed  04-centos5-repos.sed       07-centos5-docs.sed
02-centos5-donate.sed   05-centos5-centosplus.sed  08-centos5-wiki.sed
03-centos5-yum.sed      06-centos5-support.sed     09-centos5-virtalization.sed

See: Translations

4. SVG Templates

SVG main templates are located under SVG/templates/ directory. SVG templates used by translate.sh script are located under SVG/ directory.

4.1. Assignments

Sometimes the same SVG template is used in various slides, due they have a same sctructure, markers name, and design. So we make files under SVG/ directory symbolic links to files under SVG/templates/ directory. This way we save disk space and have a chance to reuse templates. See the following ls output and note how some templates are pointing to the same design:

lrwxrwxrwx 1 al al   25 Jun 28 16:43 01-centos5-welcome.svg -> templates/tpl-welcome.svg
lrwxrwxrwx 1 al al   23 Jun 28 16:43 02-centos5-donate.svg -> templates/tpl-list1.svg
lrwxrwxrwx 1 al al   28 Jun 28 16:44 03-centos5-yum.svg -> templates/tpl-paragraphs.svg
lrwxrwxrwx 1 al al   23 Jun 28 16:45 04-centos5-repos.svg -> templates/tpl-list2.svg
lrwxrwxrwx 1 al al   28 Jun 28 16:44 05-centos5-centosplus.svg -> templates/tpl-paragraphs.svg
lrwxrwxrwx 1 al al   23 Jun 28 16:44 06-centos5-support.svg -> templates/tpl-list1.svg
lrwxrwxrwx 1 al al   23 Jun 28 16:45 07-centos5-docs.svg -> templates/tpl-list3.svg
lrwxrwxrwx 1 al al   28 Jun 28 16:44 08-centos5-wiki.svg -> templates/tpl-paragraphs.svg
lrwxrwxrwx 1 al al   28 Jun 28 16:45 09-centos5-virtualization.svg -> templates/tpl-paragraphs.svg
-rw-rw-r-- 1 al al  481 Jun 26 18:13 README
drwxrwxr-x 4 al al 4096 Jun 28 16:14 templates

4.2. Features

The following list shows available templates and its markers.

4.2.1. tpl-welcome.svg

One title, six paragraphs, and one url. The first paragraph is remarked in comparision with the rest of them. These paragraphs can have as many lines as you want, just take care of the number of paragraphs used to avoid overflow the content.


Used by:

4.2.2. tpl-list1.svg

One title, two lines description, four list elements (of two lines each one), and one url.


Used by:

4.2.3. tpl-paragraphs.svg

One title, six paragraphs, and one url. These paragraphs can have as many lines as you want, just take care of the number of used paragraphs to avoid content overflowing.


Used by:

4.2.4. tpl-list2.svg

One title, one line description, one column of nine list elements (of one line each one), and one url.


Used by:

4.2.5. tpl-list3.svg

One title, one line description, two columns of nine list elements (of one line each one), and one url.


Used by:

4.3. Limitations

4.4. Tips and Tricks

4.4.1. Building Lists

To build a list you can use one of the following templates: tpl-list1.svg, tpl-list2.svg, or tpl-list3.svg. Then, use a bullet characters (like ʘ , » , • ) as the first character in your indented text followed by a space and then your text. You can also use numbers to build numbered lists.

Unorder list example:

# Anaconda's slide translations
# Title   : 02-centos5-donate.png
# Template: slide-template-02.svg
# Language: cz

s/=TITLE=/Dary pro CentOS/
s/=TEXT1=/The CentOS Projekt je organizace vydávající CentOS. Tato organizace není napojena na žádnou další organizaci./
s/=TEXT2=/• Všechen hardware a výdaje na distribuci a vývoj CentOS pocházejí z darů, které jsou jediným zdrojem našich příjmů./
s/=TEXT3=/• Pokud je pro vás CentOS užitečný, prosím zvažte podporu CentOS vyjádřenou ve formě peněžních či nepeněžních darů./

4.4.2. Customizing text style

You can add text styles using definitions like the following:

You can see <flowSpan style="font-weight:bold">this text in bold</flowSpan>.

2023-09-11 07:19