blino's website

Free software developer and more

Since we use HTML in our first time desktop wizard (and in the new first boot wizard), it may be useful to use standard translations methods such as xgettext and po files.

intltool comes handy here, since it can handle XML files (Translating Custom XML). This also works with HTML files, it just requires translatables strings to be enclosed in tags with an '_' prefix.

$ cat > foo.html.in
<html>
<head><_title>Oy</_title></head>
<body><_span>w00t</_span></body>
</html>

$ intltool-extract --type=gettext/xml foo.html.in 
Generating C format header file for translation.
Wrote foo.html.in.h

$ mkdir po
$ xgettext -a foo.html.in.h -o po/foo.pot
$ cp -a po/foo.pot po/fr.po

$ emacs po/fr.po # edit po/fr.po

$ intltool-merge --xml-style -m po foo.html.in foo.html
Merging translations into foo.html.
CREATED fr/foo.html
CREATED foo.html

$ cat fr/foo.html
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head><title xml:lang="fr">Moyoto</title></head>
<body><span xml:lang="fr">\o/</span></body>
</html>


Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)