diff options
| author | Jannis Leidel | 2012-03-31 22:09:23 +0200 | 
|---|---|---|
| committer | Jannis Leidel | 2012-03-31 22:09:35 +0200 | 
| commit | 69cc4e6b93a79ed1d0958fe5b1135119c0cff2ff (patch) | |
| tree | 8ae1e20219c7c6de5a71196a9091dedddb26a1d9 /debug_toolbar/panels/timer.py | |
| parent | 545dbabb091da7c68c8d754ac70efd435416e703 (diff) | |
| download | django-debug-toolbar-69cc4e6b93a79ed1d0958fe5b1135119c0cff2ff.tar.bz2 | |
Marked a few more strings for translation.
Diffstat (limited to 'debug_toolbar/panels/timer.py')
| -rw-r--r-- | debug_toolbar/panels/timer.py | 25 | 
1 files changed, 13 insertions, 12 deletions
| diff --git a/debug_toolbar/panels/timer.py b/debug_toolbar/panels/timer.py index 7428e83..bc7f87d 100644 --- a/debug_toolbar/panels/timer.py +++ b/debug_toolbar/panels/timer.py @@ -4,7 +4,7 @@ except ImportError:      pass  # Will fail on Win32 systems  import time  from django.template.loader import render_to_string -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _  from debug_toolbar.panels import DebugPanel @@ -14,6 +14,7 @@ class TimerDebugPanel(DebugPanel):      """      name = 'Timer'      template = 'debug_toolbar/panels/timer.html' +      try:  # if resource module not available, don't show content panel          resource      except NameError: @@ -34,6 +35,7 @@ class TimerDebugPanel(DebugPanel):              self._end_rusage = resource.getrusage(resource.RUSAGE_SELF)              stats['utime'] = 1000 * self._elapsed_ru('ru_utime')              stats['stime'] = 1000 * self._elapsed_ru('ru_stime') +            stats['total'] = stats['utime'] + stats['stime']              stats['vcsw'] = self._elapsed_ru('ru_nvcsw')              stats['ivcsw'] = self._elapsed_ru('ru_nivcsw')              stats['minflt'] = self._elapsed_ru('ru_minflt') @@ -58,13 +60,15 @@ class TimerDebugPanel(DebugPanel):      def nav_subtitle(self):          stats = self.get_stats() -        # TODO l10n          if self.has_resource:              utime = self._end_rusage.ru_utime - self._start_rusage.ru_utime              stime = self._end_rusage.ru_stime - self._start_rusage.ru_stime -            return 'CPU: %0.2fms (%0.2fms)' % ((utime + stime) * 1000.0, stats['total_time']) +            return _('CPU: %(cum)0.2fms (%(total)0.2fms)') % { +                'cum': (utime + stime) * 1000.0, +                'total': stats['total_time'] +            }          else: -            return 'TOTAL: %0.2fms' % (stats['total_time']) +            return _('TOTAL: %0.2fms') % stats['total_time']      def title(self):          return _('Resource Usage') @@ -77,20 +81,17 @@ class TimerDebugPanel(DebugPanel):      def content(self):          stats = self.get_stats() - -        # TODO l10n on values          rows = ( -            (_('User CPU time'), '%0.3f msec' % stats['utime']), -            (_('System CPU time'), '%0.3f msec' % stats['stime']), -            (_('Total CPU time'), '%0.3f msec' % (stats['utime'] + stats['stime'])), -            (_('Elapsed time'), '%0.3f msec' % stats['total_time']), -            (_('Context switches'), '%d voluntary, %d involuntary' % (stats['vcsw'], stats['ivcsw'])), +            (_('User CPU time'), _('%(utime)0.3f msec') % stats), +            (_('System CPU time'), _('%(stime)0.3f msec') % stats), +            (_('Total CPU time'), _('%(total)0.3f msec') % stats), +            (_('Elapsed time'), _('%(total_time)0.3f msec') % stats), +            (_('Context switches'), _('%(vcsw)d voluntary, %(ivcsw)d involuntary') % stats),  #            ('Memory use', '%d max RSS, %d shared, %d unshared' % (stats['rss'], stats.['srss'],  #                                                                   stats['urss'] + stats['usrss'])),  #            ('Page faults', '%d no i/o, %d requiring i/o' % (stats['minflt'], stats['majflt'])),  #            ('Disk operations', '%d in, %d out, %d swapout' % (stats['blkin'], stats['blkout'], stats['swap'])),          ) -          context = self.context.copy()          context.update({'rows': rows})          return render_to_string(self.template, context) | 
