-Packages::CGI::init_url( $input, \%params, \%opts );
-
- my $locale = get_locale($opts{lang});
- my $charset = get_charset($opts{lang});
- setlocale ( LC_ALL, $locale )
- or do { debug( "couldn't set locale $locale, using default" ) if DEBUG;
- setlocale( LC_ALL, get_locale() )
- or do {
- debug( "couldn't set default locale either" ) if DEBUG;
- setlocale( LC_ALL, "C" );
- };
- };
- debug( "locale=$locale charset=$charset", 2 ) if DEBUG;
+ Packages::CGI::init_url( $input, \%params, \%opts );
+
+ if (defined($opts{lang})) {
+ $opts{po_lang} = $PO_LANGUAGES{$opts{lang}} ? $opts{lang} : 'en';
+ $opts{ddtp_lang} = $DDTP_LANGUAGES{$opts{lang}} ? $opts{lang} : 'en';
+ } else {
+ $opts{po_lang} = $po_lang;
+ $opts{ddtp_lang} = $ddtp_lang;
+ }
+ my $charset = "UTF-8";
+ my $cat = Packages::I18N::Locale->get_handle( $opts{po_lang}, 'en' )
+ or die "get_handle failed for $opts{po_lang}";
+ $opts{cat} = $cat;