Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

locale - languages

  • How to deal with Operating Systems and applications that change the language of their messages based on the locale of the system?

  • This is not really a testing specific issue.

use strict;
use warnings;

use Test::More tests => 1;

use POSIX qw(locale_h);
my $locale = setlocale(LC_CTYPE);
diag $locale;

# OSX/English: en_US.UTF-8
# Windows:
# Hebrew_Israel.1255

my $ipconfig = 'Windows IP Configuration';
if ($locale eq 'German_Germany.1252') {
    $ipconfig = 'Windows-IP-Konfiguration';
}

SKIP: {
    skip "Windows related tests", 1 if $^O !~ /MSWin/i;
    like( `ipconfig`, qr/$ipconfig/ );
}