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

Re: More i18n of the base system : perl scripts



Le Fri, Feb 12, 1999 at 12:19:53PM +0100, Santiago Vila écrivait:
> If it were a shell script, the following could be done:
> 
> if [ -x /usr/bin/gettext ]; then
    TEXTDOMAIN="script_domain"
>   echo="gettext -s"
> else
>   echo="echo"
> fi

> So, no, I don't see the need to make this essential or required (unless
> perl scripting is less powerful than shell scripting, of course ;-), and

Of course not but, the problem is that gettext provides more than just
gettext, here's what could be done :

-----
#!/usr/bin/perl -w

BEGIN { eval 'use Locale::gettext'; 
        if ($@) { 
	  *gettext     = sub { shift }; 
	  *dcgettext   = sub { shift; shift };
	  *dgettext    = sub { shift; shift };
	  *textdomain  = sub { 0 };
	  *bindtextdomain = sub { 0 };
	  *LC_CTYPE    = sub { 0 };
	  *LC_NUMERIC  = sub { 1 };
	  *LC_TIME     = sub { 2 };
	  *LC_COLLATE  = sub { 3 };
	  *LC_MONETARY = sub { 4 };
	  *LC_MESSAGES = sub { 5 };
	  *LC_ALL      = sub { 6 };
	} 
      };
      
use POSIX qw(setlocale);

setlocale(LC_MESSAGES, "");
textdomain("dpkg");

print gettext("dpkg: %s: warning - failed to link `%.250s' to `%.250s': %s\n");
print gettext("diverted by %s");
-----

I can do this for all scripts I'll internationalize but I wonder if
this is really useful as the liblocale-gettext-perl package does 
only take 11394 bytes ...

I still think that this module should be in base even with a lower 
priority, the fact is that non-english people should benefit from
locales as soon as possible (that's why it does need to be in base).
I think base/standard would do it then ?

Cheers,
-- 
Raphaël Hertzog >> 0C4CABF1 >> http://prope.insa-lyon.fr/~rhertzog/


Reply to: