iso2022jp.pmd
上传用户:shbosideng
上传日期:2013-05-04
资源大小:1555k
文件大小:6k
- ###### PATCHTAG00 ####################################################
- ### $BF|K8l(B(ISO-2022-JP)
- ### => Fuminori Uematsu <uematsu@kgz.com>
- ###### PATCHTAG10 ####################################################
- &iso2022jp
- ###### PATCHTAG20 ####################################################
- 'iso2022jp' => &iso2022jp,
- 'iso-2022-jp' => &iso2022jp,
- ###### PATCHTAG30 ####################################################
- # iso2022jp/iso-2022-jp
- 'iso2022jp' =>
- "e$BF|K\8lLue(B(ISO-2022-JP)e$B:n@.e(B
- <a href="http://www.kgz.com/~uematsu/">e$B?">>e(B e$BJ8FAe(B</a>
- <a href="mailto:uematsu@kgz.com"><uematsu@kgz.com></a>",
- ###### PATCHTAG40 ####################################################
- $credits::LOCALE{'iso-2022-jp'}=$credits::LOCALE{'iso2022jp'};
- ###### PATCHTAG50 ####################################################
- # iso2022jp
- sub iso2022jp
- {
- my $string = shift;
- return "" unless defined $string;
- my(%translations,%month,%wday);
- my($i,$j);
- my(@dollar,@quux,@foo);
-
- # regexp => replacement string NOTE does not use autovars $1,$2...
- # charset=iso-2022-jp
- %translations =
- (
- '^iso-8859-1' => 'iso-2022-jp',
- '^Maximal 5 Minute Incoming Traffic' => 'e\$B:GBge(B5e\$BJ,<u?.NLe(B',
- '^Maximal 5 Minute Outgoing Traffic' => 'e\$B:GBge(B5e\$BJ,Aw?.NLe(B',
- '^the device' => 'e\$B%G%P%\$%9e(B',
- '^The statistics were last updated (.*)' => 'e\$B99?7F|;~e(B $1',
- '^Average)' => 'e\$BJ?6Qe(B)',
- '^Average$' => 'e\$BJ?6Qe(B',
- '^Max$' => 'e\$B:GBge(B',
- '^Current' => 'e\$B:G?7e(B',
- '^`Daily' Graph ((.*) Minute' => 'e\$BF|%0%i%Ue(B($1e\$BJ,4Ve(B',
- '^`Weekly' Graph (30 Minute' => 'e\$B=5%0%i%Ue(B(30e\$BJ,4Ve(B',
- '^`Monthly' Graph (2 Hour' => 'e\$B7n%0%i%Ue(B(2e\$B;~4Ve(B',
- '^`Yearly' Graph (1 Day' => 'e\$BG/%0%i%Ue(B(1e\$BF|e(B',
- '^Incoming Traffic in (S+) per Second' => 'e\$BKhIC\$N<u?.e(B$1e\$B?te(B',
- '^Incoming Traffic in (S+) per Minute' => 'e\$BKhJ,\$N<u?.e(B$1e\$B?te(B',
- '^Incoming Traffic in (S+) per Hour' => 'e\$BKh;~\$N<u?.e(B$1e\$B?te(B',
- '^Outgoing Traffic in (S+) per Second' => 'e\$BKhIC\$NAw?.e(B$1e\$B?te(B',
- '^Outgoing Traffic in (S+) per Minute' => 'e\$BKhJ,\$NAw?.e(B$1e\$B?te(B',
- '^Outgoing Traffic in (S+) per Hour' => 'e\$BKh;~\$NAw?.e(B$1e\$B?te(B',
- '^at which time (.*) had been up for (.*)' => '$1e\$B\$N2TF/;~4Ve(B $2',
- '^Average max 5 min values for `Daily' Graph ((.*) Minute interval):' => 'e\$BF|%0%i%U\$G\$N:GBge(B5e\$BJ,CM\$NJ?6Qe(B($1e\$BJ,4V3Ve(B):',
- '^Average max 5 min values for `Weekly' Graph (30 Minute interval):' => 'e\$B=5%0%i%U\$G\$N:GBge(B5e\$BJ,CM\$NJ?6Qe(B(30e\$BJ,4V3Ve(B):',
- '^Average max 5 min values for `Monthly' Graph (2 Hour interval):' => 'e\$B7n%0%i%U\$G\$N:GBge(B5e\$BJ,CM\$NJ?6Qe(B(2e\$B;~4V4V3Ve(B):',
- '^Average max 5 min values for `Yearly' Graph (1 Day interval):' => 'e\$BG/%0%i%U\$G\$N:GBge(B5e\$BJ,CM\$NJ?6Qe(B(1e\$BF|4V3Ve(B):',
- #'^([kMG]?)([bB])/s' => '$1$2/e\$BICe(B',
- #'^([kMG]?)([bB])/min' => '$1$2/e\$BJ,e(B',
- #'^([kMG]?)([bB])/h' => '$1$2/e\$B;~e(B',
- '^Bits$' => 'e\$B%S%C%He(B',
- '^Bytes$' => 'e\$B%P%\$%He(B',
- '^In$' => 'e\$B<u?.e(B',
- '^Out$' => 'e\$BAw?.e(B',
- '^Percentage' => 'e\$BHfN(e(B',
- '^Ported to OpenVMS Alpha by' => 'OpenVMS Alphae\$B\$X\$N0\?"e(B',
- '^Ported to WindowsNT by' => 'WindowsNTe\$B\$X\$N0\?"e(B',
- #'^and' => 'and',
- '^GREEN' => 'e\$BNPe(B',
- '^BLUE' => 'e\$B\@De(B',
- '^DARK GREEN' => 'e\$B?<NPe(B',
- '^MAGENTA' => 'e\$B%^%<%s%?e(B',
- '^AMBER' => 'e\$B`h`ae(B'
- );
- # maybe expansions with replacement of whitespace would be more appropriate
- foreach $i (keys %translations)
- {
- my $trans = $translations{$i};
- $trans =~ s/|/\|/;
- return $string if eval " $string =~ s|${i}|${trans}| ";
- };
- %wday =
- (
- 'Sunday' => "(e$BF|e(B)",
- 'Monday' => "(e$B7ne(B)",
- 'Tuesday' => "(e$B2Pe(B)",
- 'Wednesday' => "(e$B?ee(B)",
- 'Thursday' => "(e$BLZe(B)",
- 'Friday' => "(e$B6be(B)",
- 'Saturday' => "(e$BEZe(B)",
- );
- %month =
- (
- 'January' => "1e$B7ne(B", 'February' => "2e$B7ne(B",
- 'March' => "3e$B7ne(B", 'April' => "4e$B7ne(B",
- 'May' => "5e$B7ne(B", 'June' => "6e$B7ne(B",
- 'July' => "7e$B7ne(B", 'August' => "8e$B7ne(B",
- 'September' => "9e$B7ne(B", 'October' => "10e$B7ne(B",
- 'November' => "11e$B7ne(B", 'December' => "12e$B7ne(B",
- );
- @foo=($string=~/(S+),s+(S+)s+(S+)s+(.*)/);
- if($foo[0] && $wday{$foo[0]} && $foo[2] && $month{$foo[2]} )
- {
- if($foo[3]=~/at/)
- {
- @quux=split(/s+ats+/,$foo[3]);
- }
- else
- {
- @quux=split(/ /,$foo[3],2);
- };
- return "$quux[0]e$BG/e(B$month{$foo[2]}$foo[1]e$BF|e(B$wday{$foo[0]} $quux[1]";
- };
- #
- # handle two different time/date formats:
- # return "$wday, $mday $month ".($year+1900)." at $hour:$min";
- # return "$wday, $mday $month ".($year+1900)." $hour:$min:$sec GMT";
- #
- # handle nontranslated strings which ought to be translated
- # print STDERR "$_n" or print DEBUG "not translated $_";
- # but then again we might not want/need to translate all strings
-
- return $string;
- };