From 2f7ee397d33dc7dc15d083d2b6f6a60a0260c433 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 1 May 2010 22:07:43 -0400 Subject: more translation fixes --- django_authopenid/urls.py | 2 +- forum/management/commands/once_award_badges.py | 16 +- forum/management/commands/sximport.py | 109 ----- forum/migrations/0005_install_badges.py | 2 +- forum/skins/default/templates/badge.html | 4 +- forum/skins/default/templates/badges.html | 9 +- forum/skins/default/templates/user_recent.html | 2 +- forum/skins/default/templates/user_stats.html | 40 +- locale/de/LC_MESSAGES/django.mo | Bin 37992 -> 37992 bytes locale/de/LC_MESSAGES/django.po | 150 ++---- locale/en/LC_MESSAGES/django.mo | Bin 25411 -> 25184 bytes locale/en/LC_MESSAGES/django.po | 9 +- locale/ru/LC_MESSAGES/django.mo | Bin 32607 -> 32607 bytes locale/ru/LC_MESSAGES/django.po | 119 ++--- locale/tr/LC_MESSAGES/django.mo | Bin 63247 -> 53616 bytes locale/tr/LC_MESSAGES/django.po | 620 ++++++++++++++++++------- 16 files changed, 572 insertions(+), 510 deletions(-) delete mode 100755 forum/management/commands/sximport.py diff --git a/django_authopenid/urls.py b/django_authopenid/urls.py index e1986d19..65afc45a 100755 --- a/django_authopenid/urls.py +++ b/django_authopenid/urls.py @@ -33,7 +33,7 @@ urlpatterns = patterns('django_authopenid.views', url(r'^%s%s$' % (_('password/'), _('confirm/')), 'confirmchangepw', name='user_confirmchangepw'), # manage account settings - url(r'^$', _('account_settings'), name='user_account_settings'), + url(r'^$', 'account_settings', name='user_account_settings'), url(r'^%s$' % _('password/'), 'changepw', name='user_changepw'), url(r'^%s%s$' % (_('email/'),_('validate/')), 'changeemail', name='user_validateemail',kwargs = {'action':'validate'}), url(r'^%s%s$' % (_('email/'), _('change/')), 'changeemail', name='user_changeemail'), diff --git a/forum/management/commands/once_award_badges.py b/forum/management/commands/once_award_badges.py index 372eb3aa..60457373 100755 --- a/forum/management/commands/once_award_badges.py +++ b/forum/management/commands/once_award_badges.py @@ -144,22 +144,10 @@ class Command(BaseCommand): new_award.save() def first_type_award(self): - """ - This will award below badges for users first behaviors: - - (7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 0, 0), - (8, '清洁工', 3, '清洁工', '第一次撤销投票', 0, 0), - (9, '批评家', 3, '批评家', '第一次反对票', 0, 0), - (10, '小编', 3, '小编', '第一次编辑更新', 0, 0), - (11, '村长', 3, '村长', '第一次重新标签', 0, 0), - (12, '学者', 3, '学者', '第一次标记答案', 0, 0), - (14, '支持者', 3, '支持者', '第一次赞成票', 0, 0), - (16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 0, 0), - """ + activity_types = ','.join('%s' % item for item in BADGE_AWARD_TYPE_FIRST.keys()) # ORDER BY user_id, activity_type query = "SELECT id, user_id, activity_type, content_type_id, object_id FROM activity WHERE is_auditted = 0 AND activity_type IN (%s) ORDER BY user_id, activity_type" % activity_types - cursor = connection.cursor() try: cursor.execute(query) @@ -203,8 +191,6 @@ class Command(BaseCommand): def first_ask_be_voted(self): """ For user asked question and got first upvote, we award him following badge: - - (13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 0, 0), """ query = "SELECT act.user_id, q.vote_up_count, act.object_id FROM " \ "activity act, question q WHERE act.activity_type = %s AND " \ diff --git a/forum/management/commands/sximport.py b/forum/management/commands/sximport.py deleted file mode 100755 index f6af4e90..00000000 --- a/forum/management/commands/sximport.py +++ /dev/null @@ -1,109 +0,0 @@ -from django.core.management.base import LabelCommand -from zipfile import ZipFile -from xml.dom import minidom as dom -import datetime - -from forum.models import User - -class Command(LabelCommand): - def handle_label(self, label, **options): - zip = ZipFile(label) - - map = {} - - map['users'] = self.import_users(zip.open("Users.xml")) - map['questions'], map['answers'] = self.import_posts(zip.open("Posts.xml")) - - - def row_to_dic(self, row): - return dict([ - (child.localName.lower(), - " ".join([t.nodeValue for t in child.childNodes if t.nodeType == t.TEXT_NODE])) - for child in row.childNodes - if child.nodeType == child.ELEMENT_NODE - ]) - - def from_sx_time(self, timestring): - if timestring is None: - return timestring - - try: - return datetime.datetime.strptime(timestring, '%Y-%m-%dT%H:%M:%S') - except: - return datetime.datetime.strptime(timestring, '%Y-%m-%dT%H:%M:%S.%f') - - - def import_users(self, users): - pkey_map = {} - doc = dom.parse(users) - - rows = doc.getElementsByTagName('row') - unknown_count = 0 - - added_names = [] - - for row in rows: - values = self.row_to_dic(row) - - username = values.get('displayname', - values.get('realname', - values.get('email', None))) - - if username is None: - unknown_count += 1 - username = 'Unknown User %d' % unknown_count - - if username in added_names: - cnt = 1 - new_username = "%s %d" % (username, cnt) - while new_username in added_names: - cnt += 1 - new_username = "%s %d" % (username, cnt) - - username = new_username - - added_names.append(username) - - user = User(username=username, email=values.get('email', '')) - - user.reputation = values['reputation'] - user.last_seen = self.from_sx_time(values['lastaccessdate']) - - user.real_name = values.get('realname', '') - user.about = values.get('aboutme', '') - user.website = values.get('websiteurl', '') - user.date_of_birth = self.from_sx_time(values.get('birthday', None)) - user.location = values.get('location', '') - - user.is_active = True - user.email_isvalid = True - - - if int(values['usertypeid']) == 5: - user.is_superuser = True - - if int(values['usertypeid']) == 5: - user.is_staff = True - - user.save() - - pkey_map[values['id']] = user - - return users - - def import_posts(self, posts, map): - pkey_map = {} - doc = dom.parse(posts) - - rows = doc.getElementsByTagName('row') - - for row in rows: - map = { - 'title': row[''] - } - - pass - pass - - - diff --git a/forum/migrations/0005_install_badges.py b/forum/migrations/0005_install_badges.py index e260bcf6..5c05ecdd 100644 --- a/forum/migrations/0005_install_badges.py +++ b/forum/migrations/0005_install_badges.py @@ -35,7 +35,7 @@ INITIAL_BADGE_DATA = ( (_('Civic duty'), 2, _('civic-duty'), _('Voted 300 times'), False, 0), (_('Strunk & White'), 2, _('strunk-and-white'), _('Edited 100 entries'), False, 0), (_('Generalist'), 2, _('generalist'), _('Active in many different tags'), False, 0), - (_('Expert'), 2, _('export'), _('Very active in one tag'), False, 0), + (_('Expert'), 2, _('expert'), _('Very active in one tag'), False, 0), (_('Yearling'), 2, _('yearling'), _('Active member for a year'), False, 0), (_('Notable Question'), 2, _('notable-question'), _('Asked a question with 2,500 views'), True, 0), (_('Enlightened'), 2, _('enlightened'), _('First answer was accepted with at least 10 up votes'), False, 0), diff --git a/forum/skins/default/templates/badge.html b/forum/skins/default/templates/badge.html index af6aa2a2..12a12512 100644 --- a/forum/skins/default/templates/badge.html +++ b/forum/skins/default/templates/badge.html @@ -3,7 +3,7 @@ {% load i18n %} {% load extra_tags %} {% load humanize %} -{% block title %}{% spaceless %}{{ badge.name }} - {% trans "Badge" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans badge.name %} - {% trans "Badge" %}{% endspaceless %}{% endblock %} {% block forejs %}