Blame translate/cn.pmd

Packit 667938
###### PATCHTAG00 ####################################################
Packit 667938
###      cn/中文汉字
Packit 667938
###      => 李晨光 <zurkabsd@yahoo.com.cn>
Packit 667938
###	 => MSN:chenguang2001@hotmail.com FreeBSD Fan
Packit 667938
###	 => MRTG完美汉化.
Packit 667938
###### PATCHTAG10 ####################################################
Packit 667938
  &cn
Packit 667938
###### PATCHTAG20 ####################################################
Packit 667938
  'cn'          => \&cn,
Packit 667938
  '中文汉字'         => \&cn,
Packit 667938
###### PATCHTAG30 ####################################################
Packit 667938
# cn/中文汉字
Packit 667938
   'cn' =>
Packit 667938
   "  
Packit 667938
    MRTG完美汉化:
Packit 667938
    <NOBR>李晨光
Packit 667938
  
Packit 667938
  <zurkabsd\@yahoo.com.cn></NOBR>",
Packit 667938
###### PATCHTAG40 ####################################################
Packit 667938
$credits::LOCALE{'中文汉字'}=$credits::LOCALE{'cn'};
Packit 667938
###### PATCHTAG50 ####################################################
Packit 667938
# cn s-Chinese
Packit 667938
Packit 667938
sub cn
Packit 667938
{
Packit 667938
  my $string = shift;
Packit 667938
return "" unless defined $string;
Packit 667938
  my(%translations,%month,%wday);
Packit 667938
Packit 667938
  my($i,$j);
Packit 667938
  my(@dollar,@quux,@foo);
Packit 667938
Packit 667938
  
Packit 667938
  # regexp => replacement string NOTE does not use autovars $1,$2...
Packit 667938
Packit 667938
  %translations =
Packit 667938
  (  
Packit 667938
     'charset=iso-8859-1'                     => 'charset=gb2312',
Packit 667938
     'Maximal 5 Minute Incoming Traffic'      => '5分钟最大流入量',
Packit 667938
     'Maximal 5 Minute Outgoing Traffic'      => '5分钟最大流出量',
Packit 667938
     'the device'                             => '设备',
Packit 667938
     'The statistics were last updated(.*)'   => '统计最后更新时间:$1',
Packit 667938
     ' Average\)
' => ' 平均)
',
Packit 667938
     '<SMALL>Average(.*)'     => '<SMALL>平均$1',
Packit 667938
     '<SMALL>Max(.*)'         => '<SMALL>最大$1',
Packit 667938
     '<SMALL>Current(.*)'     => '<SMALL>当前$1',
Packit 667938
     'version'                                => '版本',
Packit 667938
     '`Daily\' Graph \((.*) Minute'        => '"每日" 图表 ($1 分钟',
Packit 667938
     '`Weekly\' Graph \(30 Minute'         => '"每周" 图表 (30 分钟' ,
Packit 667938
     '`Monthly\' Graph \(2 Hour'           => '"每月" 图表 (2 小时',
Packit 667938
     '`Yearly\' Graph \(1 Day'             => '"每年" 图表 (1 天', 
Packit 667938
     'Incoming Traffic in (\S+) per Second'   => '每秒流入 $1 量',
Packit 667938
     'Outgoing Traffic in (\S+) per Second'   => '每秒流出 $1 量',
Packit 667938
     'at which time (.*) had been up for(.*)' => '此时 $1 已运作了: $2 ',
Packit 667938
     '(.+)/s$'                                => '$1/秒',
Packit 667938
     '(.+)/min$'                              => '$1/分',
Packit 667938
     '(.+)/h$'                                => '$1/时',
Packit 667938
     # 'Bits'                                 => 'Bits',
Packit 667938
     # 'Bytes'                                => 'Bytes'
Packit 667938
     ' In:</FONT>'                       => ' 流入:</FONT>',
Packit 667938
     ' Out:</FONT>'                      => ' 流出:</FONT>',
Packit 667938
     ' Percentage</FONT>'                => ' 百分比:</FONT>',
Packit 667938
     'Ported to OpenVMS Alpha by'             => '移植到 OpenVMS 者', 
Packit 667938
     'Ported to WindowsNT by'                 => '移植到 WindowsNT 者',
Packit 667938
     'and'                                    => '和',
Packit 667938
     '^GREEN'                                 => '绿',
Packit 667938
     'BLUE'                                   => '蓝',
Packit 667938
     'DARK GREEN'                             => '墨绿',
Packit 667938
     'MAGENTA'                                => '紫',
Packit 667938
     'AMBER'                                  => '琥珀色'
Packit 667938
  );
Packit 667938
Packit 667938
# maybe expansions with replacement of whitespace would be more appropriate
Packit 667938
Packit 667938
foreach $i (keys %translations)
Packit 667938
{  
Packit 667938
  my $trans = $translations{$i};
Packit 667938
  $trans =~ s/\|/\|/;  
Packit 667938
  return $string if eval " \$string =~ s|\${i}|${trans}| ";
Packit 667938
};
Packit 667938
Packit 667938
%wday = 
Packit 667938
    (
Packit 667938
      'Sunday'    => '星期天',    'Sun' => '日',
Packit 667938
      'Monday'    => '星期一',    'Mon' => '一',
Packit 667938
      'Tuesday'   => '星期二',    'Tue' => '二',
Packit 667938
      'Wednesday' => '星期三',    'Wed' => '三',
Packit 667938
      'Thursday'  => '星期四',    'Thu' => '四',
Packit 667938
      'Friday'    => '星期五',    'Fri' => '五',
Packit 667938
      'Saturday'  => '星期六',    'Sat' => '六' 
Packit 667938
Packit 667938
    );
Packit 667938
Packit 667938
%month = 
Packit 667938
    (
Packit 667938
      'January'   => ' 一 月',    'February'  => ' 二 月',      'March'     => ' 三 月',
Packit 667938
      'April'     => ' 四 月',    'May'       => ' 五 月',      'June'      => ' 六 月', 
Packit 667938
      'July'      => ' 七 月',    'August'    => ' 八 月',      'September' => ' 九 月', 
Packit 667938
      'October'   => ' 十 月',    'November'  => '十一月',      'December'  => '十二月', 
Packit 667938
      'Jan'       => '1月',      'Feb'       => '2月',        'Mar'       => '3月',
Packit 667938
      'Apr'       => '4月',      'May'       => '5月',        'Jun'       => '6月',
Packit 667938
      'Jul'       => '7月',      'Aug'       => '8月',        'Sep'       => '9月', 
Packit 667938
      'Oct'       => '10月',      'Nov'       => '11月',        'Dec'       => '12月' 
Packit 667938
Packit 667938
	);
Packit 667938
Packit 667938
Packit 667938
  @foo=($string=~/(\S+),\s+(\S+)\s+(\S+)(.*)/);
Packit 667938
  if($foo[0] && $wday{$foo[0]} && $foo[2] && $month{$foo[2]} )
Packit 667938
    {
Packit 667938
	  if($foo[3]=~(/(.*)at(.*)/))
Packit 667938
        { 
Packit 667938
          @quux=split(/at/,$foo[3]);
Packit 667938
	      $foo[3]=$quux[0];
Packit 667938
          $foo[4]=$quux[1]; 
Packit 667938
        };
Packit 667938
      return "$foo[3]年 $month{$foo[2]} $foo[1] 日 ,$wday{$foo[0]} ,$foo[4]"; 
Packit 667938
    };
Packit 667938
Packit 667938
#
Packit 667938
# handle two different time/date formats:  
Packit 667938
# return "$wday, $mday $month ".($year+1900)." at $hour:$min";
Packit 667938
# return "$wday, $mday $month ".($year+1900)." $hour:$min:$sec GMT";
Packit 667938
#
Packit 667938
Packit 667938
# handle nontranslated strings which ought to be translated
Packit 667938
# print STDERR "$_\n" or print DEBUG "not translated $_";
Packit 667938
# but then again we might not want/need to translate all strings
Packit 667938
  
Packit 667938
  return $string;
Packit 667938
Packit 667938
};