const char *lines[] = "Line 1n", "Line 2n", NULL ;In this case we have a problem, because if we just replace the strings by _(”string”), it won’t directly work. Remember that _ is a macro for the function gettext. In C, it just won’t let us call it from the constructor, because the string should have to be assigned statically. In C++ it will let us, but the resulting program will happen to call gettext() on them before our initialization in main(), and thus it will simply not work. I’ve made available an example on how those situations could be handled both in C and C++.
#ifdef USE_GETTEXT #include "libintl.h" #include "locale.h" #define _(String) gettext (String) #else #define _(String) String #endifAnd add this at the beginning of your main() function:
#ifdef USE_GETTEXT
setlocale (LC_MESSAGES, "");
setlocale (LC_CTYPE, "");
setlocale (LC_COLLATE, "");
textdomain ("my-program");
bindtextdomain ("my-program", NULL);
#endif
That’s all for the initialization of gettext, lets go now with its usage from the rest of the modules. In each of them, you’d have to add this to the headers:
#ifdef USE_GETTEXT #include "libintl.h" #define _(String) gettext (String) #else #define _(String) String #endifAfter all that stuff, you should be able to i18n for whichever texts you want, just write _(”whatever”) instead of whatever:
printf(_("whatever");
Don’t forget to compile your program with -DUSE_GETTEXT if you use the same #defines as I do, or at least to #define USE_GETTEXT somewhere. Now, lets go to the second part, generating the .pot templates, and installing the .mo translation modules in your system:
xgettext -k_ -o my-program.pot *.c *.h --from-code=iso-8859-1If you prefer, you can create different .pot files for the different parts of your programs instead a really big one to help translators, and then joining all the .po files inside a single one before converting it to .mo with msgcat:
msgcat -o my-program.es.po my-program.part1.es.po my-program.part2.po my-program.part3.es.poTo compile the .po files into .mo, just do:
msgfmt my-program.es.po -o my-program.es.moThen, don’t forget to install it in the proper directory of your system:
cp my-program.es.mo /usr/share/locale/es/LC_MESSAGES/my-program.moOf course, you can tell your program to look for the .mo file in a different directory, even a relative one, instead. Just read the man pages, this is only a quick recipe on how to do it

Zonbu and its skins — high-powered dressing for a low-power device Price-wise, you can get the Zonbu for as little as $99 if you commit to two years' subscription to the network storage. Understanding the open source ethos, Zonbu also offer the box without any tether for $250. As with the Mac mini, supplying the keyboard, mouse and monitor is up to you. Preloaded with an office suite, email, IM, web browser, multimedia player, games and Skype, Zonbu is aimed at being a general computing appliance. You can't install anything else on it, but then again, that way you can't break it easily either. It sounds the sort of thing I'd be happy leaving with non-technical family and friends. Storage with Amazon S3 Low-power solid state devices are nothing new of course, there are a variety available, and things such as the NSLU2 have been in production for some years. The novel thing about the Zonbu however is in how it manages its storage. The Zonbu has 4GB of compact flash storage on board, which it uses as a cache for Amazon's S3 storage network. All your files get encrypted and sent to S3, and are retrieved when you need them. One really neat consequence of this is that you can get at your data via the web any time you want. Secondly, it gives me some sense of security for my data. I don't know if Zonbu will give me the 'keys' to my data on S3, but it wouldn't be hard for them to provide an easy way to migrate out. Either way, S3 is a place I'd trust with my data. Why Zonbu is important Windows, and to some extent, Mac OS X, are becoming the needy children of computing, always tugging on your arm and asking you something. In contrast, Zonbu looks like a great step towards "appliance computing". Its features are more like those you'd expect from your phone or cable TV provider:
Next.