Tag Archives: i18n

Cool: Transifex interface

Transifex is the excellent translation software used by the Fedora team. It has a nice web interface where you can see summaries of translation status for the different projects (libguestfs, anaconda, Fedora docs, …)

Advertisements

Leave a comment

Filed under Uncategorized

Using gettext with Perl

We added gettext support for the Perl code in libguestfs today. We used libintl-perl which is pleasantly simple to use, and works well with our existing C-based i18n infrastructure.

To translate a file, we just add this at the top:

use Locale::TextDomain 'libguestfs';

and we mark strings as potentially translatable just by prefixing them with a double underscore:

die __"virt-inspector: no YAML support\n"
        unless exists $INC{"YAML/Any.pm"};

This doesn’t work with substitutions for reasons that are explained in the FAQ, so instead we have to use brace substitutions and the __x function:

die __x("guest image {imagename} does not exist or is not readable",
         imagename => $_)
       unless -r $_;

One large missing part is how to translate all the internal POD which we use to document interfaces and generate manpages. As far as I can tell there seems to be no good solution to translating POD today.

Leave a comment

Filed under Uncategorized

Why “minimal” is 225 MB

As I mentioned in the last post a “minimal” febootstrap Fedora install clocks in at a staggering 225 MB. When I say minimal, I mean just bash and the simplest command-line tools from coreutils:

$ ls /bin
arch      chgrp  cut   echo   fgrep  ls      mv    rmdir  stty   true
basename  chmod  date  egrep  grep   mkdir   nice  sh     su     uname
bash      chown  dd    env    link   mknod   pwd   sleep  sync   unlink
cat       cp     df    false  ln     mktemp  rm    sort   touch

Where does all the space go?

Thanks to KDE’s filelight tool, we can easily visualize the disk usage, in a nice interactive graphical way.

filelight

34% of the total disk space (76 MB) is taken up with a single file, /usr/lib/locale/locale-archive. We suspect this is an optional file that contains all locale information and is mapped into every glibc-using process. Since the minimal image I have in mind is non-interactive, there doesn’t seem to be much point in having locales at all, and this can be deleted. Obviously if you wanted an interactive, internationalized Fedora, you can’t just go and remove this file.

Another 34% is taken up with the yum cache, ie. the packages that we installed. This just needs to be deleted, and febootstrap should have an option to do this automatically.

6% (15 MB) are the locale files. As explained above, these can go.

3% (8 MB) is, extraordinarily, cracklib. It turns out that coreutils requires pam, which requires cracklib to test the strength of passwords. This is completely useless for us, because the virtual machine image won’t even have a login prompt, never mind the ability to change passwords.

A further 5% is documentation, man pages and i18n stuff that we don’t care about.

Just removing the above brings the image down to 38 MB. The next step will be to do some much more aggressive minimization, based on analyzing the binaries that we’re actually going to use and their dependencies.

26 Comments

Filed under Uncategorized