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


ACME-Error-Translate documentation Contained in the ACME-Error-Translate distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

  use ACME::Error Translate => de;

  die "Stop!"; # Anschlag!

DESCRIPTION

Top

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

By default the backend is Babelfish.

AUTHOR

Top

Casey West <casey@geeknest.com>

SEE ALSO

Top

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


ACME-Error-Translate documentation Contained in the ACME-Error-Translate distribution.

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__