Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into profiles branch #73

Merged
merged 1 commit into from
Apr 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/Zonemaster/CLI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Zonemaster::Engine::Zone;
use Scalar::Util qw[blessed];
use Encode;
use Zonemaster::LDNS;
use POSIX qw[setlocale LC_MESSAGES];
use POSIX qw[setlocale LC_MESSAGES LC_CTYPE];
use List::Util qw[max];
use Text::Reflow qw[reflow_string];
use JSON::XS;
Expand Down Expand Up @@ -261,11 +261,18 @@ sub run {
my $printed_something;

if ( $self->locale ) {
my $loc = setlocale( LC_MESSAGES, $self->locale );
if ( not defined $loc ) {
printf STDERR __( "Warning: setting locale %s failed (is it installed on this system?).\n\n" ),
$self->locale;
}
undef $ENV{LANGUAGE};
$ENV{LC_ALL} = $self->locale;
}

# Set LC_MESSAGES and LC_CTYPE separately (https://www.gnu.org/software/gettext/manual/html_node/Triggering.html#Triggering)
if ( not defined setlocale( LC_MESSAGES, "" ) ) {
printf STDERR __( "Warning: setting locale category LC_MESSAGES to %s failed (is it installed on this system?).\n\n" ),
$ENV{LANGUAGE} || $ENV{LC_ALL} || $ENV{LC_MESSAGES};
}
if ( not defined setlocale( LC_CTYPE, "" ) ) {
printf STDERR __( "Warning: setting locale category LC_CTYPE to %s failed (is it installed on this system?).\n\n" ),
$ENV{LC_ALL} || $ENV{LC_CTYPE};
}

if ( $self->version ) {
Expand Down