ACME-Error-Translate

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension ACME::Error::Translate.

0.01  Fri Sep 20 11:55:11 2002
	- original version; created by h2xs 1.2 with options
		-XAn ACME::Error::Translate

MANIFEST  view on Meta::CPAN

Changes
Makefile.PL
MANIFEST
test.pl
Translate.pm

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    'NAME'		=> 'ACME::Error::Translate',
    'VERSION_FROM'	=> 'Translate.pm', # finds $VERSION
    'PREREQ_PM'		=> { ACME::Error => 0.01, Lingua::Translate => 0.01 }, # e.g., Module::Name => 1.1
);

Translate.pm  view on Meta::CPAN

package ACME::Error::Translate;

use strict;
no  strict 'refs';

use vars qw[$VERSION];
$VERSION = '0.01';

use Lingua::Translate;

{
  my $translator = undef;
  sub import {
    my $class = shift;
    $translator = Lingua::Translate->new( src => 'en', dest => shift );
  }

  *die_handler = *warn_handler = sub {
    if ( $translator ) {
      return map $translator->translate( $_ ), @_;
    } else {
      return @_;
    }
  };
}

1;
__END__

=head1 NAME

ACME::Error::Translate - Language Translating Backend for ACME::Error

=head1 SYNOPSIS

  use ACME::Error Translate => de;

  die "Stop!"; # Anschlag!

=head1 DESCRIPTION

Translates error messages from the default English to the language of your
choice using L<Lingua::Translate>.  As long as the backend used by
L<Lingua::Translage> understands your two letter language code, you're ok.

By default the backend is Babelfish.

=head1 AUTHOR

Casey West <F<casey@geeknest.com>>

=head1 SEE ALSO

perl(1), ACME::Error, Lingua::Translate.

=cut

test.pl  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use ACME::Error::Translate;
$loaded = 1;
print "ok 1\n";

######################### End of black magic.

# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.546 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )