Internationalizing X.Org applications

Samuel Thibault samuel.thibault at ens-lyon.org
Tue Dec 5 15:39:50 PST 2006


Hi,

I'm a bit late in the thread, and maybe a bit off-topic

Alan Coopersmith, le Tue 21 Nov 2006 18:08:45 -0800, a écrit :
> A few years back, the Sun X team started a project to internationalize the
> X commands.   Unfortunately, we didn't get too many done before other 
> projects
> became higher priority and the work wasn't finished.   (A quick scan of our
> tree shows we did gettext() conversions for sxpm, cxpm, xfontsel, xload, 
> xman,
> xfd, and xhost.)

I would just like to mention a small experimental script that I wrote
for internationalization of Xt apps:
http://sourceforge.net/mailarchive/message.php?msg_id=37283949
(the sourceforge page has inlined the script so I attached it to this
mail too).  There wasn't much response, but nobody against this approach
(which was suggested some time ago on xorg@)

I'm not sure which project (Xorg/translation) should do the resource <->
po conversion and maintain such script.

What are your opinions?

Samuel
-------------- next part --------------
#!/bin/sh
while [ $# -gt 0 ]
do
	(
		cat << EOF
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
int main(int argc, char *argv[]) {
	setlocale(LC_MESSAGES,"");

	if (!(bindtextdomain("$1", "."))) {
		perror("bindtextdomain");
		exit(EXIT_FAILURE);
	}

	if (!textdomain("$1")) {
		perror("textdomain");
		exit(EXIT_FAILURE);
	}
EOF
		grep -ie '^[^:!]*label:' "$1" | ( \
			while read line
			do
				echo "	printf(\"%s\\n\",gettext(\"$line\"));"
			done
		)
		cat << EOF
	return 0;
}
EOF
	) > "$1.c"
	shift
done


More information about the xorg mailing list