Changeset 18

Show
Ignore:
Timestamp:
02/05/06 10:25:30
Author:
miyagawa
Message:

Fix i18n issues in templates and Subject

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger.pm

    r13 r18  
    1717use Plagger::Subscription; 
    1818use Plagger::Update; 
     19 
    1920use Template; 
     21use Template::Provider::Encoding 0.04; 
     22use Template::Stash::ForceUTF8; 
    2023 
    2124our $TT; 
     
    134137    unless ($TT) { 
    135138        my $path = $self->conf->{template_path} || 'templates'; 
    136         $TT = Template->new({ INCLUDE_PATH => [ $path, "$path/plugins" ] }); 
     139        my $paths = [ $path, "$path/plugins" ]; 
     140        $TT = Template->new({ 
     141            INCLUDE_PATH => $paths, 
     142            LOAD_TEMPLATES => [ 
     143                Template::Provider::Encoding->new({ INCLUDE_PATH => $paths }), 
     144            ], 
     145            STASH => Template::Stash::ForceUTF8->new, 
     146        }); 
    137147    } 
    138148    $TT; 
  • trunk/plagger/lib/Plagger/Feed.pm

    r7 r18  
    33 
    44use base qw( Class::Accessor::Fast ); 
    5 __PACKAGE__->mk_accessors(qw( title link url image description language author updated tags stash )); 
     5__PACKAGE__->mk_accessors(qw( link url image description language author updated tags stash )); 
    66 
    77sub new { 
     
    2929} 
    3030 
     31sub title { 
     32    my $self = shift; 
     33    if (@_) { 
     34        my $title = shift; 
     35        utf8::decode($title) unless utf8::is_utf8($title); 
     36        $self->{title} = $title; 
     37    } 
     38    $self->{title}; 
     39} 
     40 
    31411; 
  • trunk/plagger/lib/Plagger/Plugin/Publish/Gmail.pm

    r4 r18  
    3434sub send_email_feed { 
    3535    my($self, $context, $feed, $items) = @_; 
    36     my $subject = $feed->{title} || '(no-title)'; 
     36    my $subject = $feed->title || '(no-title)'; 
    3737    my $body = join '<hr />', map $self->templatize($context, $feed, $_), @$items; 
    3838    $self->do_send_mail($context, $feed, $subject, $body); 
     
    4141sub send_email_item { 
    4242    my($self, $context, $feed, $item) = @_; 
    43     my $subject = $item->{title} || '(no-title)'; 
     43    my $subject = $item->title || '(no-title)'; 
    4444    my $body    = $self->templatize($context, $feed, $item); 
    4545    $self->do_send_mail($context, $feed, $subject, $body); 
     
    5252    $context->log(warn => "Sending $subject to $cfg->{mailto}"); 
    5353 
    54     my $feed_title = $feed->{title}
     54    my $feed_title = $feed->title
    5555       $feed_title =~ tr/,//d; 
    5656