Changeset 5607
- Timestamp:
- 06/26/09 11:28:55 (3 years ago)
- Location:
- trunk/Locale-Msgfmt
- Files:
-
- 4 edited
-
Changes (modified) (1 diff)
-
lib/Locale/Msgfmt/Utils.pm (modified) (1 diff)
-
lib/Locale/Msgfmt/po.pm (modified) (3 diffs)
-
t/msgfmt.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Locale-Msgfmt/Changes
r5583 r5607 1 1 Revision history for Locale-Msgfmt 2 3 0.06 Jun 26, 2009 4 add support for contexts 2 5 3 6 0.05 Jun 25, 2009 -
trunk/Locale-Msgfmt/lib/Locale/Msgfmt/Utils.pm
r5583 r5607 50 50 } 51 51 52 sub eot { 53 return chr(4); 54 } 55 52 56 1; -
trunk/Locale-Msgfmt/lib/Locale/Msgfmt/po.pm
r5583 r5607 1 1 package Locale::Msgfmt::po; 2 3 use Locale::Msgfmt::Utils; 2 4 3 5 use strict; … … 28 30 return if ($h{fuzzy} && !$self->{fuzzy} && length($h{msgid}) > 0); 29 31 return if($h{msgstr} eq ""); 30 $self->{mo}->add_string(cleanup_string($h{msgid}), cleanup_string($h{msgstr})); 32 my $context; 33 if($h{msgctxt}) { 34 $context = cleanup_string($h{msgctxt}) . Locale::Msgfmt::Utils::eot(); 35 } else { 36 $context = ""; 37 } 38 $self->{mo}->add_string($context . cleanup_string($h{msgid}), cleanup_string($h{msgstr})); 31 39 } 32 40 … … 40 48 while (<F>) { 41 49 s/\r\n/\n/; 42 if(/^(msgid|msgstr ) +"(.*)" *$/) {50 if(/^(msgid|msgstr|msgctxt) +"(.*)" *$/) { 43 51 $type = $1; 44 if( $type eq "msgid" && defined($h{msgid})) {52 if(defined($h{$type})) { 45 53 $self->add_string(\%h); 46 54 %h = (); -
trunk/Locale-Msgfmt/t/msgfmt.t
r5605 r5607 31 31 } 32 32 do_one_test("fr-fr"); 33 do_one_test("context"); 33 34 TODO: { 34 35 local $TODO = "not yet implemented"; 35 do_one_test("context");36 36 37 do_one_test("ngettext"); 37 38 }
Note: See TracChangeset
for help on using the changeset viewer.
