Changeset 7280
- Timestamp:
- 11/16/08 14:59:09 (5 years ago)
- Files:
-
- modules/branches/2.5/dashboard/class.astinfo.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.5/dashboard/class.astinfo.php
r7180 r7280 215 215 } 216 216 $astout = explode("\n",$response['data']); 217 217 218 219 // Only translate and do the preg_replace if in another language, since it is a somewhat expensive operation 220 // 221 if ($_COOKIE['lang'] == "en_US") { 222 $translate = false; 223 } else { 224 $translate = true; 225 $units = array( 226 '/second/', '/seconds/', 227 '/minute/', '/minutes/', 228 '/hour/', '/hours/', 229 '/day/', '/days/', 230 '/week/', '/weeks/', 231 '/year/', '/years/', 232 ); 233 $tunits = array( 234 _('second'), _('seconds'), 235 _('minute'), _('minutes'), 236 _('hour'), _('hours'), 237 _('day'), _('days'), 238 _('week'), _('weeks'), 239 _('year'), _('years'), 240 ); 241 } 218 242 foreach ($astout as $line) { 219 243 if (preg_match('/^System uptime: (.*)$/i',$line,$matches)) { 220 244 $output["system"] = preg_replace('/,\s+(\d+ seconds?)?\s*$/', '', $matches[1]); 245 if ($translate) { 246 $output["system"] = preg_replace($units,$tunits,$output["system"]); 247 } 221 248 } else if (preg_match('/^Last reload: (.*)$/i',$line,$matches)) { 222 249 $output["reload"] = preg_replace('/,\s+(\d+ seconds?)?\s*$/', '', $matches[1]); 250 if ($translate) { 251 $output["reload"] = preg_replace($units,$tunits,$output["reload"]); 252 } 223 253 } 224 254 }
