comparison MoinMoin/stats/languages.py @ 3122:a1322262398a

refactored _() getText calls to match new api
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 27 Feb 2008 00:23:46 +0100
parents af5872a8f022
children 2a3a6cb34e45
comparison
equal deleted inserted replaced
3121:ca1c60a5285c 3122:a1322262398a
52 for cnt, lang in data: 52 for cnt, lang in data:
53 total += cnt 53 total += cnt
54 54
55 55
56 languages = TupleDataset() 56 languages = TupleDataset()
57 languages.columns = [Column('language', label=_("Language", formatted=False), align='left'), 57 languages.columns = [Column('language', label=_("Language"), align='left'),
58 Column('value', label='%', align='right')] 58 Column('value', label='%', align='right')]
59 59
60 cnt_printed = 0 60 cnt_printed = 0
61 data = data[:10] 61 data = data[:10]
62 62
63 # Preparing "<Browser setting>" 63 # Preparing "<Browser setting>"
64 browserlang = _('<Browser setting>', formatted=False) 64 browserlang = _('<Browser setting>')
65 browserlang = browserlang[1:len(browserlang) - 1].capitalize() 65 browserlang = browserlang[1:len(browserlang) - 1].capitalize()
66 if total: 66 if total:
67 for cnt, lang in data: 67 for cnt, lang in data:
68 try: 68 try:
69 if lang == u'browser': 69 if lang == u'browser':
77 'count': cnt})) 77 'count': cnt}))
78 cnt_printed += cnt 78 cnt_printed += cnt
79 except UnicodeError: 79 except UnicodeError:
80 pass 80 pass
81 if total > cnt_printed: 81 if total > cnt_printed:
82 languages.addRow((_('Others', formatted=False), "%(percent).2f%% (%(count)d)" % { 82 languages.addRow((_('Others'), "%(percent).2f%% (%(count)d)" % {
83 'percent': 100.0 * (total - cnt_printed) / total, 83 'percent': 100.0 * (total - cnt_printed) / total,
84 'count': total - cnt_printed})) 84 'count': total - cnt_printed}))
85 85
86 else: # If we don't have any users, we can safely assume that the only real user is the visitor (who is normally ignored, though) who is using "Browser setting" 86 else: # If we don't have any users, we can safely assume that the only real user is the visitor (who is normally ignored, though) who is using "Browser setting"
87 languages.addRow((browserlang, "100% (1)")) 87 languages.addRow((browserlang, "100% (1)"))