[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using gettext in scripts

On Thu, Dec 13, 2001 at 02:58:52AM -0200, Gustavo Noronha Silva wrote:
> Hello,
> maybe someone here can point me to some good manual on how to
> use gettext on shell scripts?
	Ussing gettext is easy. Check out the euro-support's euro-test
script which uses gettext (and I did not have the least idea how to do it
before I implemented it). Just call in the shell script:

gettext "my message"

after defining the domain for gettext.

Gettext extraction is not that difficult, I hacked a perl script in ~5 min
which would make the neccessary .pot for translation. It's in the sources
but is quite simple:

#!/usr/bin/perl -n

if (/gettext.*?"(.*?)"/ ) {
        print "#at line $count\nmsgid \"$1\"\nmsgstr \"\"\n";

Just do 'cat file.sh | perl script' 



Reply to: