App-rdapper
view release on metacpan or search on metacpan
Changes
Dockerfile
lib/App/rdapper.pm
lib/App/rdapper/l10n.pm
locale/de/LC_MESSAGES/rdapper.mo
locale/de/LC_MESSAGES/rdapper.po
locale/en/LC_MESSAGES/rdapper.mo
locale/en/LC_MESSAGES/rdapper.po
locale/es/LC_MESSAGES/rdapper.mo
locale/es/LC_MESSAGES/rdapper.po
locale/fr/LC_MESSAGES/rdapper.mo
locale/fr/LC_MESSAGES/rdapper.po
locale/pt/LC_MESSAGES/rdapper.mo
locale/pt/LC_MESSAGES/rdapper.po
locale/rdapper.pot
Makefile.PL
MANIFEST This list of files
mkmo.sh
rdapper
README.md
t/00.use.t
t/01-l10n.t
t/02.test.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
Makefile.PL view on Meta::CPAN
#!/usr/bin/env perl
use ExtUtils::MakeMaker;
use File::ShareDir::Install;
use strict;
install_share module => 'App::rdapper' => 'locale';
WriteMakefile(
'NAME' => 'App::rdapper',
'VERSION_FROM' => 'lib/App/rdapper.pm',
'ABSTRACT_FROM' => 'lib/App/rdapper.pm',
'AUTHOR' => [ 'Gavin Brown <gavin.brown@fastmail.uk>' ],
'LICENSE' => 'perl_5',
'EXE_FILES' => [ 'rdapper' ],
'CONFIGURE_REQUIRES' => {
lib/App/rdapper.pm view on Meta::CPAN
use Getopt::Long qw(GetOptionsFromArray :config pass_through);
use JSON;
use List::Util qw(any min max uniq);
use Net::ASN;
use Net::DNS::Domain;
use Net::IDN::PP;
use Net::IP;
use Net::RDAP::EPPStatusMap;
use Net::RDAP 0.41;
use Pod::Usage;
use POSIX qw(setlocale LC_ALL);
use Term::ANSIColor;
use Term::Size;
use Text::Wrap;
use URI;
use constant {
GETTEXT_DOMAIN => q{rdapper},
# see RFC 6350, Section 6.3.1.
'ADR_STREET' => 2,
'ADR_CITY' => 3,
'ADR_SP' => 4,
'ADR_PC' => 5,
'ADR_CC' => 6,
'INDENT' => ' ',
'IANA_BASE_URL' => 'https://rdap.iana.org/',
};
use locale;
use vars qw($VERSION $LH);
use strict;
$VERSION = '1.25';
$LH = App::rdapper::l10n->get_handle;
$LH->die_for_lookup_failures(1);
$LH->bindtextdomain(GETTEXT_DOMAIN, $ENV{RDAPPER_LOCALE_DIR} || module_dir(__PACKAGE__));
$LH->textdomain(GETTEXT_DOMAIN);
lib/App/rdapper/l10n.pm view on Meta::CPAN
=pod
=head1 NAME
C<App::rdapper::l10n> - internationalisation support for L<App::rdapper>
=head1 DESCRIPTION
The L<rdapper|App::rdapper> RDAP client can generate output that is localized to
the user's locale. It uses L<Locale::Maketext::Gettext> and a dictionary of
translated strings stored in .po files.
=head1 TRANSLATING STRINGS
C<rdapper> has an undocumented command line option, C<--strings>, which causes
it to print a .pot template on STDOUT. This is used to generate the
C<rdapper.pot> file in the C<locale> directory.
This directory contains subdirectories for each supported locale. To create a
new locale, create a new subdirectory and copy C<rdapper.pot> into it:
$ mkdir -p ja/LC_MESSAGES
$ cp rdapper.pot ja/LC_MESSAGES/rdapper.po
Once you have finished editing C<rdapper.po>, run C<mkmo.sh> to compile the
.po files into .mo files. These files are installed automatically when rdapper
is installed.
You will also need to edit the file C<l10.pm> to add a new package, which must
look like this:
#!/bin/sh
# compile all .po files
find locale -name '*.po' | while read po ; do
echo "$po"
msgfmt -o "$(dirname "$po")/$(basename "$po" .po).mo" "$po" || exit 1
done
t/01-l10n.t view on Meta::CPAN
},
);
# Dynamically calculate the number of tests
my $total_tests = 0;
$total_tests += scalar keys %{ $lang_tests{$_} } for keys %lang_tests;
plan tests => $total_tests;
# Main test loop
foreach my $lang_code ( sort keys %lang_tests ) {
my $po_file = File::Spec->catfile('locale', $lang_code, 'LC_MESSAGES', 'rdapper.po');
SKIP: {
skip("Skipping tests for '$lang_code': $po_file not found.",
scalar keys %{ $lang_tests{$lang_code} }) unless -f $po_file;
# Parse the .po file into a hash
my %translations = parse_po_file($po_file);
# Run the specific tests for this language
foreach my $original ( sort keys %{ $lang_tests{$lang_code} } ) {
( run in 1.463 second using v1.01-cache-2.11-cpan-5735350b133 )