Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / debian / libwx-perl / usr / lib / perl5 / Wx / Locale.pm
1 #############################################################################
2 ## Name:        lib/Wx/Locale.pm
3 ## Purpose:     Wx::Locale
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     02/02/2001
7 ## RCS-ID:      $Id: Locale.pm 2057 2007-06-18 23:03:00Z mbarbon $
8 ## Copyright:   (c) 2001-2002 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 package Wx::Locale;
14
15 use strict;
16
17 *Wx::gettext = \&Wx::GetTranslation;
18 *Wx::gettext_noop = sub { $_[0] };
19
20 @Wx::Locale::T::ISA = qw(Exporter);
21
22 sub import {
23   my $temp = shift;
24
25   require Exporter;
26
27   package Wx::Locale::T;
28   no strict;
29
30   my( $from, $to, @export );
31   if( @_ == 1 && $_[0] eq ':default' ) {
32     @_ = ( 'gettext', 'gettext', 'gettext_noop', 'gettext_noop' )
33   }
34
35   while( @_ ) {
36     $from = shift;
37     $to = shift;
38
39     *{"Wx::Locale::T::$to"} = *{"Wx::$from"};
40     push @export, $to;
41   }
42
43   push @Wx::Locale::T::EXPORT_OK, @export;
44   Wx::Locale::T->export_to_level( 1, $temp, @export );
45 }
46
47 sub new {
48   shift;
49
50   # this should be conditionally defined, but it does no harm to leave
51   # like it is
52   Wx::_match( @_, $Wx::_n_n, 1, 1 )       && return Wx::Locale::newShort( @_ );
53   Wx::_match( @_, $Wx::_s_s_s_b_b, 1, 1 ) && return Wx::Locale::newLong( @_ );
54   Wx::_croak Wx::_ovl_error;
55 }
56
57 1;
58
59 # Local variables: #
60 # mode: cperl #
61 # End: #