Commits

Gregory Petukhov committed 3a6496a Merge

Merge

Comments (0)

Files changed (7)

 *.swp
 *.swo
 *.orig
+*~
 *.egg-info/
 dist/

feedzilla/admin.py

 # -*- coding: utf-8
 
 from django.contrib import admin
+from django.utils.translation import ugettext_lazy as _
+
 from feedzilla.models import Feed, Post, FilterTag, FilterWord, Request
 
+
+def html_link(link):
+    return u'<a href="%(link)s">%(label)s</a>' % {'link': link, 'label': _('link')}
+
+
 class FeedAdmin(admin.ModelAdmin):
     list_display = ['title', 'active', 'last_checked',
                     'admin_feed_url', 'admin_site_url']
     search_fields = ['title', 'site_url']
 
     def admin_feed_url(self, obj):
-        return u'<a href="%s">ссылка</a>' % obj.feed_url
+        return html_link(obj.feed_url)
     admin_feed_url.allow_tags = True
 
     def admin_site_url(self, obj):
-        return u'<a href="%s">ссылка</a>' % obj.site_url
+        return html_link(obj.site_url)
     admin_site_url.allow_tags = True
 
 class PostAdmin(admin.ModelAdmin):
     search_fields = ['title', 'link', 'feed__title']
 
     def admin_post_link(self, obj):
-        return u'<a href="%s">ссылка</a>' % obj.link
+        return html_link(obj.link)
     admin_post_link.allow_tags = True
 
 class FilterTagAdmin(admin.ModelAdmin):

feedzilla/forms.py

         except Request.DoesNotExist:
             return value
         else:
-            raise forms.ValidationError(u'Заявка для этого адреса уже была отправлена')
+            raise forms.ValidationError(_('This address has been already submitted.'))
 
     def save(self):
         url = self.cleaned_data['url']
         obj = Request.objects.create(url=url)
-        body = u'Новая заявка для планеты: %s' % url
-        mail_admins(u'%s: новая заявка' % app_settings.SITE_TITLE, body)
+        body = _('New submission for the planet: %s') % url
+        mail_admins(_('%s: new submission') % app_settings.SITE_TITLE, body)
         return obj

feedzilla/locale/ru/LC_MESSAGES/django.po

+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-10-24 23:22+0600\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: admin.py:8 models.py:47
+msgid "link"
+msgstr "ссылка"
+
+#: forms.py:18
+msgid "This address has been already submitted."
+msgstr "Заявка для этого адреса уже была отправлена"
+
+#: forms.py:23
+#, python-format
+msgid "New submission for the planet: %s"
+msgstr "Новая заявка для планеты: %s"
+
+#: forms.py:24
+#, python-format
+msgid "%s: new submission"
+msgstr "%s: новая заявка"
+
+#: models.py:13 models.py:46
+msgid "title"
+msgstr ""
+
+#: models.py:14
+msgid "feed url"
+msgstr "адрес фида"
+
+#: models.py:15
+msgid "site url"
+msgstr "адрес сайта"
+
+#: models.py:16 models.py:53
+msgid "active"
+msgstr "активен"
+
+#: models.py:18
+msgid "last checked"
+msgstr "время последней проверки"
+
+#: models.py:19
+msgid "allow all messages"
+msgstr "разрешать все сообщения"
+
+#: models.py:20
+msgid "blog author"
+msgstr "автор блога"
+
+#: models.py:32 models.py:45
+msgid "feed"
+msgstr "фид"
+
+#: models.py:33
+msgid "feeds"
+msgstr "фиды"
+
+#: models.py:48
+msgid "summary"
+msgstr "введение"
+
+#: models.py:49
+msgid "content"
+msgstr "содержимое"
+
+#: models.py:50
+msgid "creation time"
+msgstr "время создания"
+
+#: models.py:51
+msgid "identifier"
+msgstr "идентификатор"
+
+#: models.py:60
+msgid "post"
+msgstr "публикация"
+
+#: models.py:61
+msgid "posts"
+msgstr "публикации"
+
+#: views.py:78
+#, python-format
+msgid "Your query is shorter than %d characters"
+msgstr "Ваш запрос короче %d символов"
+
+#: views.py:98
+msgid "Thanks, your submission has been accepted and will be reviewed by admin"
+msgstr "Спасибо. Ваша заявка принята и будет рассмотрена администратором сайта"

feedzilla/management/commands/feedzilla_update.py

+# -*- coding: utf-8 -*-
 import logging
 from datetime import datetime
 
 from django.core.management.base import BaseCommand
-from django.conf import settings
 
 from feedzilla.util.parse import parse_feed
 from feedzilla.models import Feed, Post
+from feedzilla import settings
 
 class Command(BaseCommand):
     help = u'Update feeds'
             logging.debug('parsing %s' % feed.feed_url)
 
             resp = parse_feed(feed.feed_url, etag=feed.etag,
-                              summary_size=settings.FEEDZILLA_SUMMARY_SIZE)
+                              summary_size=settings.SUMMARY_SIZE)
             if not resp['success']:
                 logging.debug('Failure')
             else:

feedzilla/models.py

 from django.db.models import permalink
 from django.db import models
 from django.core.urlresolvers import reverse
+from django.utils.translation import ugettext_lazy as _
 
 from tagging.fields import TagField
 
 class Feed(models.Model):
-    title = models.CharField(u'Название', max_length=255)
-    feed_url = models.URLField(u'Адрес фида', unique=True, verify_exists=False)
-    site_url = models.URLField(u'Адрес сайта', verify_exists=False)
-    active = models.BooleanField(u'Активен', blank=True, default=True)
+    title = models.CharField(_('title'), max_length=255)
+    feed_url = models.URLField(_('feed url'), unique=True, verify_exists=False)
+    site_url = models.URLField(_('site url'), verify_exists=False)
+    active = models.BooleanField(_('active'), blank=True, default=True)
     etag = models.CharField(u'ETag', max_length=255, blank=True, default='')
-    last_checked = models.DateTimeField(u'Время пооследней проверки', blank=True, null=True)
-    skip_filters = models.BooleanField(u'Разрешать все сообщения', blank=True, default=False)
-    author = models.CharField('Автор блога', blank=True, max_length=255)
+    last_checked = models.DateTimeField(_('last checked'), blank=True, null=True)
+    skip_filters = models.BooleanField(_('allow all messages'), blank=True, default=False)
+    author = models.CharField(_('blog author'), blank=True, max_length=255)
 
     def __unicode__(self):
         return self.title
         return urlsplit(self.site_url).hostname
 
     class Meta:
-        verbose_name = u'Фид'
-        verbose_name_plural = u'Фиды'
+        verbose_name = _('feed')
+        verbose_name_plural = _('feeds')
 
     def author_or_title(self):
         return self.author or self.title
 
-   
+
 class ActivePostManager(models.Manager):
     def get_query_set(self):
         return super(ActivePostManager, self).get_query_set().filter(active=True)
 
 
 class Post(models.Model):
-    feed = models.ForeignKey(Feed, verbose_name=u'Фид', related_name='posts')
-    title = models.CharField(u'Заголовок', max_length=255)
-    link = models.TextField(u'Ссылка')
-    summary = models.TextField(u'Введение', blank=True)
-    content = models.TextField(u'Содержимое', blank=True)
-    created = models.DateTimeField(u'Время создания')
-    guid = models.CharField(u'Идентификатор', max_length=255, unique=True)
+    feed = models.ForeignKey(Feed, verbose_name=_('feed'), related_name='posts')
+    title = models.CharField(_('title'), max_length=255)
+    link = models.TextField(_('link'))
+    summary = models.TextField(_('summary'), blank=True)
+    content = models.TextField(_('content'), blank=True)
+    created = models.DateTimeField(_('creation time'))
+    guid = models.CharField(_('identifier'), max_length=255, unique=True)
     tags = TagField()
-    active = models.BooleanField(u'Активен', blank=True, default=True)
+    active = models.BooleanField(_('active'), blank=True, default=True)
 
     objects = models.Manager()
     active_objects = ActivePostManager()
 
     class Meta:
         ordering = ['-created']
-        verbose_name = u'Публикация'
-        verbose_name_plural = u'Публикации'
+        verbose_name = _('post')
+        verbose_name_plural = _('posts')
 
     def __unicode__(self):
         return self.title

feedzilla/views.py

 from django.shortcuts import get_object_or_404
 from django.db.models import Count
 from django.db import connection
+from django.utils.translation import ugettext_lazy as _
 
 from common.decorators import render_to, paged
 from common.pagination import paginate
 
 @render_to('feedzilla/search.html')
 def search(request):
-    query = request.GET.get('query', '') 
+    query = request.GET.get('query', '')
     min_limit = 2
     if len(query) < min_limit:
         posts = []
-        message = u'Ваш запрос короче %d символов' % min_limit
+        message = _('Your query is shorter than %d characters') % min_limit
     else:
         posts = Post.active_objects.filter(content__icontains=query)
         message = ''
     success = None
     if form.is_valid():
         form.save()
-        success = u'Спасибо. Ваша заявка принята и будет рассмотрена администратором сайта'
+        success = _('Thanks, your submission has been accepted and will be '
+                    'reviewed by admin')
     return {'form': form,
             'success': success,
             }