diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/edmail.in | 21 | ||||
-rw-r--r-- | scripts/parse-patch.in | 21 | ||||
-rw-r--r-- | scripts/remove-trailing-ws.in | 21 |
3 files changed, 57 insertions, 6 deletions
diff --git a/scripts/edmail.in b/scripts/edmail.in index 5413f0c..84b192b 100644 --- a/scripts/edmail.in +++ b/scripts/edmail.in @@ -1,10 +1,27 @@ #! @PERL@ -w use Getopt::Long; -use POSIX qw(setlocale); -use Locale::gettext; use strict; +# This ugly trick lets the script work even if gettext support is missing. +# We did so because Locale::gettext doesn't ship with the standard perl +# distribution. +BEGIN { + if (eval { require Locale::gettext }) { + import Locale::gettext; + require POSIX; + import POSIX, qw(setlocale); + } else { + eval ' + use constant LC_MESSAGES => 0; + sub setlocale($$) { } + sub bindtextdomain($$) { } + sub textdomain($) { } + sub gettext($) { shift } + ' + } +} + setlocale(LC_MESSAGES, ""); bindtextdomain("quilt", "@LOCALEDIR@"); textdomain("quilt"); diff --git a/scripts/parse-patch.in b/scripts/parse-patch.in index 6441b82..cb5a8e5 100644 --- a/scripts/parse-patch.in +++ b/scripts/parse-patch.in @@ -12,10 +12,27 @@ use FileHandle; use Getopt::Long; use File::Temp qw(tempfile); -use POSIX qw(setlocale); -use Locale::gettext; use strict; +# This ugly trick lets the script work even if gettext support is missing. +# We did so because Locale::gettext doesn't ship with the standard perl +# distribution. +BEGIN { + if (eval { require Locale::gettext }) { + import Locale::gettext; + require POSIX; + import POSIX, qw(setlocale); + } else { + eval ' + use constant LC_MESSAGES => 0; + sub setlocale($$) { } + sub bindtextdomain($$) { } + sub textdomain($) { } + sub gettext($) { shift } + ' + } +} + setlocale(LC_MESSAGES, ""); bindtextdomain("quilt", "@LOCALEDIR@"); textdomain("quilt"); diff --git a/scripts/remove-trailing-ws.in b/scripts/remove-trailing-ws.in index dfda46b..8179a9a 100644 --- a/scripts/remove-trailing-ws.in +++ b/scripts/remove-trailing-ws.in @@ -8,11 +8,28 @@ use strict; use FileHandle; use File::Temp qw( :mktemp ); -use POSIX qw(setlocale); -use Locale::gettext; use Getopt::Std; use vars qw($opt_p $opt_n); +# This ugly trick lets the script work even if gettext support is missing. +# We did so because Locale::gettext doesn't ship with the standard perl +# distribution. +BEGIN { + if (eval { require Locale::gettext }) { + import Locale::gettext; + require POSIX; + import POSIX, qw(setlocale); + } else { + eval ' + use constant LC_MESSAGES => 0; + sub setlocale($$) { } + sub bindtextdomain($$) { } + sub textdomain($) { } + sub gettext($) { shift } + ' + } +} + setlocale(LC_MESSAGES, ""); bindtextdomain("quilt", "@LOCALEDIR@"); textdomain("quilt"); |