###### PATCHTAG00 #################################################### ### 日本語(UTF-8JP) ### => T.Kabu ###### PATCHTAG10 #################################################### &utf8jp ###### PATCHTAG20 #################################################### 'utf8jp' => \&utf8jp, # 'utf-8jp' => \&utf8jp, ###### PATCHTAG30 #################################################### # utf8jp/utf-8jp 'utf8jp' => "日本語訳(UTF-8JP)作成 T.Kabu <kabu\@fvg-on.net>", ###### PATCHTAG40 #################################################### #$credits::LOCALE{'utf-8jp'}=$credits::LOCALE{'utf8jp'}; ###### PATCHTAG50 #################################################### # utf8jp sub utf8jp { 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' => 'utf-8', '^Maximal 5 Minute Incoming Traffic' => '最大5分受信量', '^Maximal 5 Minute Outgoing Traffic' => '最大5分送信量', '^the device' => 'デバイス', '^The statistics were last updated (.*)' => '更新日時 $1', '^Average\)' => '平均]', '^Average$' => '平均(Ave)', '^Max$' => '最大(Max)', '^Current' => '最新(Now)', '^`Daily\' Graph \((.*) Minute' => 'グラフ1:日スパン [$1分間', '^`Weekly\' Graph \(30 Minute' => 'グラフ2:週スパン [30分間', '^`Monthly\' Graph \(2 Hour' => 'グラフ3:月スパン [2時間', '^`Yearly\' Graph \(1 Day' => 'グラフ4:年スパン [1日', '^Incoming Traffic in (\S+) per Second' => '毎秒の受信$1数', '^Incoming Traffic in (\S+) per Minute' => '毎分の受信$1数', '^Incoming Traffic in (\S+) per Hour' => '毎時の受信$1数', '^Outgoing Traffic in (\S+) per Second' => '毎秒の送信$1数', '^Outgoing Traffic in (\S+) per Minute' => '毎分の送信$1数', '^Outgoing Traffic in (\S+) per Hour' => '毎時の送信$1数', '^at which time (.*) had been up for (.*)' => '$1の稼働時間 $2', '^Average max 5 min values for `Daily\' Graph \((.*) Minute interval\):' => '日グラフでの最大5分値の平均($1分間隔):', '^Average max 5 min values for `Weekly\' Graph \(30 Minute interval\):' => '週グラフでの最大5分値の平均(30分間隔):', '^Average max 5 min values for `Monthly\' Graph \(2 Hour interval\):' => '月グラフでの最大5分値の平均(2時間間隔):', '^Average max 5 min values for `Yearly\' Graph \(1 Day interval\):' => '年グラフでの最大5分値の平均(1日間隔):', #'^([kMG]?)([bB])/s' => '$1$2/秒', #'^([kMG]?)([bB])/min' => '$1$2/分', #'^([kMG]?)([bB])/h' => '$1$2/時', '^Bits$' => 'ビット', '^Bytes$' => 'バイト', '^In$' => '受信(In)', '^Out$' => '送信(Out)', '^Percentage' => '比率(%)', '^Ported to OpenVMS Alpha by' => 'OpenVMS Alphaへの移植', '^Ported to WindowsNT by' => 'WindowsNTへの移植', #'^and' => 'and', '^GREEN' => '緑', '^BLUE' => '青', '^DARK GREEN' => '深緑', '^MAGENTA' => 'マゼンタ', '^AMBER' => '琥珀' ); # 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' => '(日曜日)', 'Monday' => '(月曜日)', 'Tuesday' => '(火曜日)', 'Wednesday' => '(水曜日)', 'Thursday' => '(木曜日)', 'Friday' => '(金曜日)', 'Saturday' => '(土曜日)', ); %month = ( 'January' => '01月', 'February' => '02月', 'March' => '03月', 'April' => '04月', 'May' => '05月', 'June' => '06月', 'July' => '07月', 'August' => '08月', 'September' => '09月', 'October' => '10月', 'November' => '11月', 'December' => '12月', ); @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+at\s+/,$foo[3]); } else { @quux=split(/ /,$foo[3],2); }; $foo[1] = sprintf("%02d",$foo[1]); return "$quux[0]年$month{$foo[2]}$foo[1]日$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; };