###### PATCHTAG 00 ###################################################
###      Chinese/中文繁體
###      => Tate Chen 陳世偉 <tate@joy-tech.com.tw>
###      => Ron 黃東隆 <ron@ko.com.tw>
###          2000/10/7    patch display '\$1\$2/s'  errors	
###### PATCHTAG 10 ###################################################
  &big5
###### PATCHTAG 20 ###################################################
  'big5'         => \&big5, 
  '中文繁體'     => \&big5,
###### PATCHTAG 30 ###################################################
# Chinese/中文繁體
   'big5' =>
   "  <HR NOSHADE>
    中文化作者
    <NOBR><A HREF=\"http://www.joy-tech.com.tw/~tate\">Tate Chen</A>
  <A HREF=\"mailto:tate\@joy-tech.com.tw\">
  &lt;tate\@joy-tech.com.tw&gt;</A></NOBR>
  and
  <NOBR><A HREF=\"http://ko.com.tw\">Donlong</A>
  <A HREF=\"mailto:donlong\@seed.net.tw\">
  &lt;donlong\@seed.net.tw&gt;</A>  
  </NOBR>",
###### PATCHTAG 40 ###################################################
$credits::LOCALE{'中文繁體'}=$credits::LOCALE{'big5'};
###### PATCHTAG 50 ###################################################
# Chinese Big5 Code

sub big5
{
  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 =
  (  
     'charset=iso-8859-1'                     => 'charset=big5',
     'Maximal 5 Minute Incoming Traffic'      => '5分鐘最大流入量',
     'Maximal 5 Minute Outgoing Traffic'      => '5分鐘最大流出量',
     'the device'                             => '裝置',
     'The statistics were last updated(.*)'   => '上次統計更新時間: $1',
     ' Average\)</B><BR>'                     => ' 平均)</B><BR>',
     '<TD ALIGN=right><SMALL>Average(.*)'     => '<TD ALIGN=right><SMALL>平均$1',
     '<TD ALIGN=right><SMALL>Max(.*)'         => '<TD ALIGN=right><SMALL>最大$1',
     '<TD ALIGN=right><SMALL>Current(.*)'     => '<TD ALIGN=right><SMALL>目前$1',
     'version'                                => '版本',
     '<B>`Daily\' Graph \((.*) Minute'        => '<B>每日 圖表 ($1 分鐘',
     '<B>`Weekly\' Graph \(30 Minute'         => '<B>每週 圖表 (30 分鐘' ,
     '<B>`Monthly\' Graph \(2 Hour'           => '<B>每月 圖表 (2 小時',
     '<B>`Yearly\' Graph \(1 Day'             => '<B>每年 圖表 (1 天',
     'Incoming Traffic in (\S+) per Second'   => '每秒流入量 (單位 $1)',
     'Outgoing Traffic in (\S+) per Second'   => '每秒流出量 (單位 $1)',
     'at which time (.*) had been up for(.*)' => '設備名稱 $1，已運作時間(UPTIME): $2',
     '(.+)/s$'                                => '$1/秒',
     '(.+)/min$'                              => '$1/分',
     '(.+)/h$'                                => '$1/時',
    # 'Bits'                                   => 'Bits',
    # 'Bytes'                                  => 'Bytes'
     '&nbsp;In:</FONT>'                       => '&nbsp;流入:</FONT>',
     '&nbsp;Out:</FONT>'                      => '&nbsp;流出:</FONT>',
     '&nbsp;Percentage</FONT>'                => '&nbsp;百分比:</FONT>',
     'Ported to OpenVMS Alpha by'             => '移植到 OpenVM Alpha 作者',
     'Ported to WindowsNT by'                 => '移植到 WindowsNT 作者',
     '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'    => '星期天',        'Sun' => '日',
      'Monday'    => '星期一',        'Mon' => '一',
      'Tuesday'   => '星期二',        'Tue' => '二',
      'Wednesday' => '星期三',        'Wed' => '三',
      'Thursday'  => '星期四',        'Thu' => '四',
      'Friday'    => '星期五',        'Fri' => '五',
      'Saturday'  => '星期六',        'Sat' => '六'

    );

%month =
    (
      'January'   => '一月',   'February'  => '二月',    'March'     => '三月',
      'Jan'       => '一',     'Feb'       => '二',      'Mar'       => '三',
      'April'     => '四月',   'May'       => '五月',    'June'      => '六月',
      'Apr'       => '四',     'May'       => '五',      'Jun'       => '六',
      'July'      => '七月',   'August'    => '八月',    'September' => '九月',
      'Jul'       => '七',     'Aug'       => '八',      'Sep'       => '九',
      'October'   => '十月',   'November'  => '十一月',  'December'  => '十二月',
      'Oct'       => '十',     'Nov'       => '十一',    'Dec'       => '十二'

    );


  @foo=($string=~/(\S+),\s+(\S+)\s+(\S+)(.*)/);
  if($foo[0] && $wday{$foo[0]} && $foo[2] && $month{$foo[2]} )
    {
        @quux=split(/at/,$foo[3]);
	if($foo[3]=~(/(.*)at(.*)/))
      { 
         $foo[3]=$quux[0];
         $foo[4]=$quux[1];
      };
       return "$foo[3] $month{$foo[2]} $foo[1] 日, $wday{$foo[0]}, $foo[4]";
    };

#
# 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;

};
