chinese.pmd
上传用户:shbosideng
上传日期:2013-05-04
资源大小:1555k
文件大小:5k
源码类别:

SNMP编程

开发平台:

C/C++

  1. ###### PATCHTAG00 ####################################################
  2. ###      Simplified Chinese/简体中文
  3. ###      => 黄华栋 <webmaster@kingisme.com>
  4. ###  => QQ:582955 欢迎讨论FreeBSD
  5. ###  => 修正了原来的错误.发布新版本.
  6. ###### PATCHTAG10 ####################################################
  7.   &chinese
  8. ###### PATCHTAG20 ####################################################
  9.   'chinese'          => &chinese,
  10.   '简体中文'         => &chinese,
  11. ###### PATCHTAG30 ####################################################
  12. # Simplified Chinese/简体中文
  13.    'chinese' =>
  14.    "全新简体中文汉化:
  15. <a href="http://www.kingisme.com">黄华栋</a>
  16. <a href="mailto:webmaster@kingisme.com">&lt;webmaster@kingisme.com&gt;</a>",
  17. ###### PATCHTAG40 ####################################################
  18. $credits::LOCALE{'简体中文'}=$credits::LOCALE{'Chinese'};
  19. ###### PATCHTAG50 ####################################################
  20. # Simplified Chinese
  21. sub chinese
  22. {
  23.   my $string = shift;
  24. return "" unless defined $string;
  25.   my(%translations,%month,%wday);
  26.   my($i,$j);
  27.   my(@dollar,@quux,@foo);
  28.   
  29.   # regexp => replacement string NOTE does not use autovars $1,$2...
  30.   %translations =
  31.   (  
  32.      'iso-8859-1'                             => 'gb2312',
  33.      'Maximal 5 Minute Incoming Traffic'      => '5分钟最大流入量',
  34.      'Maximal 5 Minute Outgoing Traffic'      => '5分钟最大流出量',
  35.      'the device'                             => '设备',
  36.      'The statistics were last updated(.*)'   => '最后统计更新时间:$1',
  37.      ' Average)'                             => ' 平均)',
  38.      'Average'                                => '平均',
  39.      'Max'                                    => '最大',
  40.      'Current'                                => '当前',
  41.      'version'                                => '版本',
  42.      '`Daily' Graph ((.*) Minute'           => '每日 图表 ($1 分钟',
  43.      '`Weekly' Graph (30 Minute'            => '每周 图表 (30 分钟' ,
  44.      '`Monthly' Graph (2 Hour'              => '每月 图表 (2 小时',
  45.      '`Yearly' Graph (1 Day'                => '每年 图表 (1 天', 
  46.      'Incoming Traffic in (S+) per Second'   => '每秒流入量 (单位 $1 )',
  47.      'Outgoing Traffic in (S+) per Second'   => '每秒流出量 (单位 $1 )',
  48.      'at which time (.*) had been up for(.*)' => ' $1 已运行了: $2 ',
  49.      '(.+)/s$'                                => '$1/秒',
  50.      '(.+)/min$'                              => '$1/分',
  51.      '(.+)/h$'                                => '$1/时',
  52.      # 'Bits'                                 => 'Bits',
  53.      # 'Bytes'                                => 'Bytes'
  54.      'In'                                     => '流入:',
  55.      'Out'                                    => '流出:',
  56.      'Percentage'                             => '百分比:',
  57.      'Ported to OpenVMS Alpha by'             => '移植到 OpenVMS 的是', 
  58.      'Ported to WindowsNT by'                 => '移植到 WindowsNT 的是',
  59.      'and'                                    => '与',
  60.      '^GREEN'                                 => '绿色',
  61.      'BLUE'                                   => '蓝色',
  62.      'DARK GREEN'                             => '墨绿',
  63.      'MAGENTA'                                => '紫色',
  64.      'AMBER'                                  => '琥珀色'
  65.   );
  66. # maybe expansions with replacement of whitespace would be more appropriate
  67. foreach $i (keys %translations)
  68. {  
  69.   my $trans = $translations{$i};
  70.   $trans =~ s/|/|/;  
  71.   return $string if eval " $string =~ s|${i}|${trans}| ";
  72. };
  73. %wday = 
  74.     (
  75.       'Sunday'    => '星期天',    'Sun' => '日',
  76.       'Monday'    => '星期一',    'Mon' => '一',
  77.       'Tuesday'   => '星期二',    'Tue' => '二',
  78.       'Wednesday' => '星期三',    'Wed' => '三',
  79.       'Thursday'  => '星期四',    'Thu' => '四',
  80.       'Friday'    => '星期五',    'Fri' => '五',
  81.       'Saturday'  => '星期六',    'Sat' => '六' 
  82.     );
  83. %month = 
  84.     (
  85.       'January'   => ' 一 月',    'February'  => ' 二 月',      'March'     => ' 三 月',
  86.       'April'     => ' 四 月',    'May'       => ' 五 月',      'June'      => ' 六 月', 
  87.       'July'      => ' 七 月',    'August'    => ' 八 月',      'September' => ' 九 月', 
  88.       'October'   => ' 十 月',    'November'  => '十一月',      'December'  => '十二月', 
  89.       'Jan'       => '1月',      'Feb'       => '2月',        'Mar'       => '3月',
  90.       'Apr'       => '4月',      'May'       => '5月',        'Jun'       => '6月',
  91.       'Jul'       => '7月',      'Aug'       => '8月',        'Sep'       => '9月', 
  92.       'Oct'       => '10月',      'Nov'       => '11月',        'Dec'       => '12月' 
  93. );
  94.   @foo=($string=~/(S+),s+(S+)s+(S+)(.*)/);
  95.   if($foo[0] && $wday{$foo[0]} && $foo[2] && $month{$foo[2]} )
  96.     {
  97.   if($foo[3]=~(/(.*)at(.*)/))
  98.         { 
  99.           @quux=split(/at/,$foo[3]);
  100.       $foo[3]=$quux[0];
  101.           $foo[4]=$quux[1]; 
  102.         };
  103.       return "$foo[3]年 $month{$foo[2]} $foo[1] 日 ,$wday{$foo[0]} ,$foo[4]"; 
  104.     };
  105. #
  106. # handle two different time/date formats:  
  107. # return "$wday, $mday $month ".($year+1900)." at $hour:$min";
  108. # return "$wday, $mday $month ".($year+1900)." $hour:$min:$sec GMT";
  109. #
  110. # handle nontranslated strings which ought to be translated
  111. # print STDERR "$_n" or print DEBUG "not translated $_";
  112. # but then again we might not want/need to translate all strings
  113.   
  114.   return $string;
  115. };