Changeset 30032 for lang/perl/DateTimeX-Lite
- Timestamp:
- 02/14/09 11:51:46 (4 years ago)
- Location:
- lang/perl/DateTimeX-Lite/trunk
- Files:
-
- 4 modified
-
lib/DateTimeX/Lite/Locale.pm (modified) (2 diffs)
-
t/locale/01basic.t (modified) (5 diffs)
-
tools/lib/DateTimeX/Lite/Tool/Locale/Generator.pm (modified) (4 diffs)
-
tools/lib/DateTimeX/Lite/Tool/Locale/LDML.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/DateTimeX-Lite/trunk/lib/DateTimeX/Lite/Locale.pm
r28645 r30032 82 82 83 83 no strict 'refs'; 84 *{$meth_name} = sub { $_[0]->{$field} }; 85 } 84 *{$meth_name} = sub { $_[0]->{$field} } } 86 85 } 87 86 … … 92 91 # By making the default format lengths part of the object's hash 93 92 # key, it allows them to be settable. 94 returnbless { @_,93 my $self = bless { @_, 95 94 default_date_format_length => 'medium', 96 95 default_time_format_length => 'medium', 97 96 }, $class; 97 98 $self->{native_language} = $self->{en_language} 99 unless exists $self->{native_language}; 100 101 my @en_pieces; 102 my @native_pieces; 103 foreach my $p ( qw( language script territory variant ) ) 104 { 105 push @en_pieces, $self->{"en_$p"} if exists $self->{"en_$p"}; 106 push @native_pieces, $self->{"native_$p"} if exists $self->{"native_$p"}; 107 } 108 109 $self->{en_complete_name} = join ' ', @en_pieces; 110 $self->{native_complete_name} = join ' ', @native_pieces; 111 112 return $self; 98 113 } 99 114 -
lang/perl/DateTimeX-Lite/trunk/t/locale/01basic.t
r27589 r30032 13 13 $f =~ s/\.dat$//; 14 14 $f 15 } sort <lib/DateTime /Lite/Locale/*.dat>;15 } sort <lib/DateTimeX/Lite/Locale/*.dat>; 16 16 # my %locale_names = map { $_ => 1 } 17 17 my %locale_ids = map { $_ => 1 } @locale_ids; … … 65 65 ok( $locale_ids{ $locale->id() }, "'$locale_id': Has a valid locale id" ); 66 66 67 TODO: {68 local $TODO = "unimplemented";69 67 ok( length $locale->name(), "'$locale_id': Has a locale name" ); 70 68 ok( length $locale->native_name(), 71 69 "'$locale_id': Has a native locale name" ); 72 }73 70 74 71 # Each iteration runs one test if DateTime.pm is not available or … … 474 471 for my $k ( sort keys %tests ) 475 472 { 473 TODO: { 476 474 my $desc = "$k for " . $locale->id(); 475 476 if ($k eq 'name' || $k eq 'language') { 477 todo_skip("$k unimplemented", 1); 478 } 479 477 480 if ( ref $tests{$k} ) 478 481 { … … 483 486 is( $locale->$k(), $tests{$k}, $desc ); 484 487 } 488 } 485 489 } 486 490 } … … 494 498 { 495 499 is( $locale->format_for($name), $formats{$name}, 496 "Format for $name with " . $locale->id() ); 500 "Format for $name with " . $locale->id() ) or 501 note( "got -> " . $locale->format_for($name) . ", expected: $formats{$name}"); 497 502 } 498 503 -
lang/perl/DateTimeX-Lite/trunk/tools/lib/DateTimeX/Lite/Tool/Locale/Generator.pm
r28646 r30032 2 2 3 3 package DateTimeX::Lite::Tool::Locale::Generator; 4 use utf8; 4 5 use Moose; 5 6 use Moose::Util::TypeConstraints; … … 134 135 my $fh = $dat_file->openw() 135 136 or die "Cannot write to $dat_file: $!"; 136 $fh->binmode(': utf8');137 $fh->binmode(':raw'); 137 138 138 139 print $fh <<EOF or die "could not write to $dat_file: $!"; … … 150 151 # 151 152 ########################################################################### 153 use utf8; 152 154 EOF 153 155 154 156 my $data = $self->generate_data($ldml->id); 155 157 156 print $fh Dumper($data); 158 local $Data::Dumper::Sortkeys = 1; 159 local $Data::Dumper::Indent = 1; 160 print $fh Data::Dumper::Dumper($data); 157 161 close($fh); 158 162 } … … 213 217 } 214 218 215 foreach my $k qw( 216 en_language 217 en_script 218 en_territory 219 en_variant 220 native_language 221 native_script 222 native_territory 223 native_variant 224 ) { 219 foreach my $k qw( en_language en_script en_territory en_variant native_language native_script native_territory native_variant) { 225 220 my $v = $ldml->$k(); 226 221 if (defined $v) { -
lang/perl/DateTimeX-Lite/trunk/tools/lib/DateTimeX/Lite/Tool/Locale/LDML.pm
r27589 r30032 350 350 { 351 351 my $native_val = $ldml->_find_one_node_text($path); 352 353 352 return $native_val if defined $native_val; 354 353 } … … 407 406 my $class = shift; 408 407 my $file = shift; 408 409 print "Parseing $file\n===\n"; 409 410 410 411 my $doc = $Parser->parse_file( $file->stringify() );
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)