Merge pull request #3 from siterra/master

Russian translation complete + no *.mo files in .gitignore
This commit is contained in:
Iacopo Spalletti 2014-02-27 15:03:03 +01:00
commit 272bd8e3ca
8 changed files with 66 additions and 23 deletions

3
.gitignore vendored
View file

@ -26,9 +26,6 @@ pip-log.txt
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project

Binary file not shown.

View file

@ -7,13 +7,16 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-27 15:00+0100\n"
"PO-Revision-Date: 2014-02-27 15:08+0100\n"
"PO-Revision-Date: 2014-02-27 16:45+0300\n"
"Last-Translator: Max Vyaznikov <maxvyaznikov@gmail.com>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));\n"
"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)"
">=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));\n"
"Language-Team: \n"
"X-Generator: Poedit 1.5.4\n"
#: cms_app.py:8 cms_plugins.py:30 cms_plugins.py:43 cms_plugins.py:54
#: cms_plugins.py:65 cms_toolbar.py:13
@ -70,10 +73,30 @@ msgstr "время изменения"
msgid "name"
msgstr "название"
#: models.py:33 models.py:84
#: models.py:75
msgid "Main image"
msgstr "Картинка для статьи"
#: models.py:77
msgid "Main image thumbnail"
msgstr "Уменьшенная копия"
#: models.py:81
msgid "Main image full"
msgstr "Полный размер"
#: models.py:86
msgid "Title"
msgstr "Заголовок"
#: models.py:33 models.py:87
msgid "slug"
msgstr "URL"
#: models.py:88
msgid "Text"
msgstr "Текст"
#: models.py:40
msgid "blog category"
msgstr "категория блога"
@ -82,6 +105,10 @@ msgstr "категория блога"
msgid "blog categories"
msgstr "категории блога"
#: models.py:64
msgid "Author"
msgstr "Автор"
#: models.py:67
msgid "Published Since"
msgstr "Опубликована с"
@ -90,6 +117,10 @@ msgstr "Опубликована с"
msgid "Published Until"
msgstr "Опубликована до"
#: models.py:72
msgid "Publish"
msgstr "Показывать на сайте"
#: models.py:72
msgid "category"
msgstr "категория"
@ -183,7 +214,7 @@ msgstr "продолжение"
#, python-format
msgid "1 article"
msgid_plural "%(articles)s articles"
msgstr[0] "1 статья"
msgstr[0] "%(articles)s статья"
msgstr[1] "%(articles)s статьи"
msgstr[2] "%(articles)s статей"

View file

@ -61,7 +61,7 @@ class Post(TranslatableModel):
"""
Blog post
"""
author = models.ForeignKey(User, null=True, blank=True)
author = models.ForeignKey(User, verbose_name=_('Author'), null=True, blank=True)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
@ -69,21 +69,23 @@ class Post(TranslatableModel):
default=timezone.now)
date_published_end = models.DateTimeField(_('Published Until'), null=True,
blank=True)
publish = models.BooleanField(default=False)
publish = models.BooleanField(_('Publish'), default=False)
categories = models.ManyToManyField(BlogCategory, verbose_name=_('category'),
related_name='blog_posts',)
main_image = FilerImageField(blank=True, null=True)
main_image = FilerImageField(verbose_name=_('Main image'), blank=True, null=True)
main_image_thumbnail = models.ForeignKey(ThumbnailOption,
verbose_name=_('Main image thumbnail'),
related_name='blog_post_thumbnail',
blank=True, null=True)
main_image_full = models.ForeignKey(ThumbnailOption,
verbose_name=_('Main image full'),
related_name='blog_post_full',
blank=True, null=True)
translations = TranslatedFields(
title=models.CharField(max_length=255),
title=models.CharField(_('Title'), max_length=255),
slug=models.SlugField(_('slug'), blank=True, db_index=True),
abstract=HTMLField(),
abstract=HTMLField(_('Text')),
meta={'unique_together': (('language_code', 'slug'),)}
)
content = PlaceholderField("post_content")

View file

@ -1,18 +1,21 @@
# -*- coding: utf-8 -*-
BLOG_IMAGE_THUMBNAIL_SIZE = {
from django.conf import settings
BLOG_IMAGE_THUMBNAIL_SIZE = getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
'size': '120x120',
'crop': True,
'upscale': False
}
})
BLOG_IMAGE_FULL_SIZE = {
BLOG_IMAGE_FULL_SIZE = getattr(settings, 'BLOG_IMAGE_FULL_SIZE', {
'size': '640x120',
'crop': True,
'upscale': False
}
})
BLOG_TAGCLOUD_MIN = 1
BLOG_TAGCLOUD_MAX = 10
BLOG_PAGINATION = 10
BLOG_LATEST_POSTS = 5
BLOG_TAGCLOUD_MIN = getattr(settings, 'BLOG_TAGCLOUD_MIN', 1)
BLOG_TAGCLOUD_MAX = getattr(settings, 'BLOG_TAGCLOUD_MAX', 10)
BLOG_PAGINATION = getattr(settings, 'BLOG_PAGINATION', 10)
BLOG_LATEST_POSTS = getattr(settings, 'BLOG_LATEST_POSTS', 5)
BLOG_POSTS_LIST_TRUNCWORDS_COUNT = getattr(settings, 'BLOG_POSTS_LIST_TRUNCWORDS_COUNT', 100)

View file

@ -33,7 +33,13 @@
<img src="{{ thumb.url }}" alt="{{ post.main_image.default_alt_text }}" width="{{ thumb.width }}" height="{{ thumb.height }}" />
</div>
{% endif %}
<div class="blog-lead">{% render_model post "abstract" %}</div>
<div class="blog-lead">
{% if not TRUNCWORDS_COUNT %}
{% render_model post "abstract" %}
{% else %}
{% render_model post "abstract" "" "" 'truncatewords_html:TRUNCWORDS_COUNT' %}
{% endif %}
</div>
<footer class="read-more">
<a href="{{ post.get_absolute_url }}">{% trans "read more" %} &raquo;</a>
</footer>

View file

@ -14,7 +14,7 @@
</header>
{% endblock %}
{% for post in post_list %}
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" %}
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %}
{% empty %}
<p class="blog-empty">{% trans "No article found." %}</p>
{% endfor %}

View file

@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, DetailView
from .models import Post, BlogCategory
from .settings import BLOG_PAGINATION
from .settings import BLOG_PAGINATION, BLOG_POSTS_LIST_TRUNCWORDS_COUNT
class BaseBlogView(object):
@ -31,6 +31,10 @@ class PostListView(BaseBlogView, ListView):
template_name = "djangocms_blog/post_list.html"
paginate_by = BLOG_PAGINATION
def get_context_data(self, **kwargs):
context = super(PostListView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = BLOG_POSTS_LIST_TRUNCWORDS_COUNT
return context
class PostDetailView(BaseBlogView, DetailView):
model = Post