Tag Archives: gettext

Genuine fragment from RHEL spec file

# Unfuck gettextize.
grep -v '/dev/tty' < /usr/bin/gettextize > gettextize
chmod +x gettextize

# Patches affect Makefile.am and configure.ac, so rerun autotools.
./gettextize -f

Personally I’ve never known a single pair of packages that cause more trouble than GNU gettext and autoconf. Probably together they have wasted thousands of years of human effort. Configure scripts probably cause extra power stations to be built.


Filed under Uncategorized

Why is gettext not an ordinary library?

Not being a regular library causes no end of constant build problems.

Like this crap because we did “gettextize” without doing “autoconf” (or vice versa):

make[2]: Entering directory `/builddir/build/BUILD/libguestfs-1.14.7/po'
*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version 0.17 but the autoconf macros are from gettext version 0.18

I just don’t get why gettext can’t be a regular, ordinary, plain library so we don’t have to constantly suffer from this sort of thing. There is surely no other library that needs to rewrite your entire build system.


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