On Wed, Jul 20, 2005 at 06:37:10PM +0200, Jean Delvare wrote:
> Hi all,
> 
> > > I just finished updating the French translation, Andreas did the
> > > German one. Looks like we are ready to release 0.42?
> 
> Hm, we have a problem. The recently introducted gettextization of the
> perl scripts introduced a dependency on Locale/gettext.pm, which appears
> NOT to be part of the standard perl distribution. I am not sure it is
> wise to add such a dependency for only error messages - theses perl
> scripts are not supposed to talk when everything works fine.
> 
> Is it technically possible to only use Locale/gettext.pm if it exists,
> and disable internationalization if it doesn't rather than plain die? If
> it is possible, then I'd suggest that we do just that.

Here is a code chunk which should do it. It comes from the po4a project
which is deeply unrelated with quilt, beside the fact that I contribute to
both.

I'm currently somehow in vacations and would prefer if someone else could
integrate this into quilt properly.

<<<<<<<<<<<<<<<<<<<<<<
=head2 Wrappers for other modules

=item textdomain($)

This is a wrapper for Locale::gettext's textdomain() so that po4a still
works if that module is missing. This wrapper also calls
setlocale(LC_MESSAGES, "") so callers don't depend on the POSIX module
either.

=cut

sub textdomain
{
    my ($domain)[EMAIL PROTECTED];
    return eval "use Locale::gettext; use POSIX; setlocale(LC_MESSAGES, '');
textdomain(\$domain)";
}

=item gettext($)

This is a wrapper for Locale::gettext's gettext() so that things still
work ok if that module is missing.

=cut

sub gettext
{
    my ($str)[EMAIL PROTECTED];
    my $rc=eval "use Locale::gettext; Locale::gettext::gettext(\$str)";
    return ($@ ? $str : $rc);
}

=item dgettext($$)

This is a wrapper for Locale::gettext's dgettext() so that things still
work ok if that module is missing.

=cut

sub dgettext
{
    my ($domain, $str)[EMAIL PROTECTED];
    my $rc=eval "use Locale::gettext; dgettext(\$domain, \$str)";
    return ($@ ? $str : $rc);
}
>>>>>>>>>>>>>>>>>>>>>>>

Have fun, Mt.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to