blob: 32d5d795e814833570f776dce9a35e2473a58dcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#-*- perl -*-
#
# Copyright (C) 2003,2004 Ken'ichi Fukamachi
#
# $FML: Language.pm,v 1.3 2004/02/29 15:57:26 fukachan Exp $
#
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 $buf1 = $header->get('Accept-Language') || '';
my $buf2 = $header->get('X-Accept-Language') || '';
my $list = [];
LANG:
for my $s (split(/\s*,\s*/, "$buf1 $buf2")) {
if ($s =~ /^\s*ja/oi) {
push(@$list, 'ja');
last LANG;
}
elsif ($s =~ /^\s*en/oi) {
push(@$list, 'en');
last LANG;
}
}
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,2004 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;
|