diff options
| author | fukachan <fukachan> | 2003-10-15 09:09:11 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-10-15 09:09:11 +0000 |
| commit | f8a4efefb134c91e0d5a8e531a91ce8446409684 (patch) | |
| tree | 414d3e73abda0123ea907dcf5f6bfa74dac6b1ff /fml/lib/Mail/Message | |
| parent | 9d17c454d9b174fae77c3b824b945b59b6b1e870 (diff) | |
| download | fml8-f8a4efefb134c91e0d5a8e531a91ce8446409684.tar.gz fml8-f8a4efefb134c91e0d5a8e531a91ce8446409684.tar.bz2 fml8-f8a4efefb134c91e0d5a8e531a91ce8446409684.zip | |
consider Accept-Language: (but not used yet now ;-).
Diffstat (limited to 'fml/lib/Mail/Message')
| -rw-r--r-- | fml/lib/Mail/Message/Language.pm | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/fml/lib/Mail/Message/Language.pm b/fml/lib/Mail/Message/Language.pm new file mode 100644 index 00000000..1056b694 --- /dev/null +++ b/fml/lib/Mail/Message/Language.pm @@ -0,0 +1,73 @@ +#-*- perl -*- +# +# Copyright (C) 2003 Ken'ichi Fukamachi +# +# $FML$ +# + +package Mail::Message::Language; +use strict; + +=head1 NAME + +Mail::Message::Language - handle *-Language: + +=head1 SYNOPSIS + + use Mail::Message::Language; + my $mh = new Mail::Message::Language; + +=head1 DESCRIPTION + +=head1 METHODS + +=cut + + +# Descriptions: return list of languages to accept as ARRAY_REF. +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: ARRAY_REF +sub accept_language_list +{ + my ($self) = @_; + my $header = $self->whole_message_header(); + my $buf = $header->get('Accept-Language'); + my $list = []; + + LANG: + for my $s (split(/\s*,\s*/, $buf)) { + if ($s =~ /^\s*ja/oi) { + push(@$list, 'ja'); + last LANG; + } + elsif ($s =~ /^\s*en/oi) { + push(@$list, 'en'); + last LANG; + } + } + + push(@$list, '*'); # any language by default. + return $list; +} + + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2003 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=cut + + +1; |
