quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Call for 0.42


From: Jean Delvare
Subject: Re: [Quilt-dev] Call for 0.42
Date: Fri, 22 Jul 2005 19:23:50 +0200

[Jean Delvare]
> One possible workaround would be to define a fake LC_MESSAGES
> constant

[Andreas Gruenbacher]
> ... and then we also need a fake setlocale.

Hm, doesn't seem so. Older perl POSIX modules have setlocale, just not
LC_MESSAGES, so we can keep using POSIX qw(setlocale).

So the following works for me:

--- scripts/remove-trailing-ws.in       18 Jul 2005 22:15:26 -0000      1.2
+++ scripts/remove-trailing-ws.in       22 Jul 2005 17:21:15 -0000
@@ -9,9 +9,21 @@
 use FileHandle;
 use File::Temp qw( :mktemp );
 use POSIX qw(setlocale);
-use Locale::gettext;
 use Getopt::Std;
 use vars qw($opt_p $opt_n);
+
+BEGIN {
+    if (eval { require Locale::gettext }) {
+       import Locale::gettext;
+    } else {
+       eval '
+           sub bindtextdomain($$) { }
+           sub textdomain($) { }
+           sub gettext($) { shift }
+           use constant LC_MESSAGES => 5;
+       '
+    }
+}
 
 setlocale(LC_MESSAGES, "");
 bindtextdomain("quilt", "@LOCALEDIR@");

And yes, it it somewhat less ugly than my original proposal was.

Thanks,
-- 
Jean Delvare




reply via email to

[Prev in Thread] Current Thread [Next in Thread]