Skip to content

Commit

Permalink
Translate all site to English
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Sokolov committed Nov 29, 2011
1 parent b277e04 commit b79334b
Show file tree
Hide file tree
Showing 43 changed files with 1,435 additions and 1,474 deletions.
2 changes: 1 addition & 1 deletion site/source/apps/techblog/admin.py
Expand Up @@ -15,7 +15,7 @@ class ArticleAdmin(admin.ModelAdmin):

def get_authors(self, obj):
return ', '.join(str(author) for author in obj.authors.all())
get_authors.short_description = u'Список авторов'
get_authors.short_description = u'Authors list'

admin.site.register(Article, ArticleAdmin)

Expand Down
64 changes: 32 additions & 32 deletions site/source/apps/techblog/feeds.py
@@ -1,32 +1,32 @@
# -*- coding: UTF-8 -*-

from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from techblog.services.articles import ArticleService
from django.utils.feedgenerator import Rss201rev2Feed

class TextXmlFeedType(Rss201rev2Feed):
mime_type = 'text/xml'

class ArticlesFeed(Feed):

title = u"Блог Progressors.org.ua"
link = "/rss/"
description = u"Новые статьи на Progressors.org.ua"
feed_type = TextXmlFeedType

def items(self):
blog_articles = ArticleService.get_feed_articles()
return blog_articles

def item_title(self, item):
return item.title

def item_link(self, item):
return reverse('view_article', kwargs={'article_id':item.id})

def item_description(self, item):
return item.short

def item_pubdate(self, item):
return item.date
# -*- coding: UTF-8 -*-

from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from techblog.services.articles import ArticleService
from django.utils.feedgenerator import Rss201rev2Feed

class TextXmlFeedType(Rss201rev2Feed):
mime_type = 'text/xml'

class ArticlesFeed(Feed):

title = u"Blog Progressors.org.ua"
link = "/rss/"
description = u"New articles on Progressors.org.ua"
feed_type = TextXmlFeedType

def items(self):
blog_articles = ArticleService.get_feed_articles()
return blog_articles

def item_title(self, item):
return item.title

def item_link(self, item):
return reverse('view_article', kwargs={'article_id':item.id})

def item_description(self, item):
return item.short

def item_pubdate(self, item):
return item.date
16 changes: 8 additions & 8 deletions site/source/apps/techblog/forms.py
Expand Up @@ -52,9 +52,9 @@ def __init__(self, *args, **kwargs):


class UserForm(forms.ModelForm):
oldpassword = forms.CharField( widget=forms.PasswordInput, label='Страрый пароль', required=False )
password1 = forms.CharField( widget=forms.PasswordInput, label=u'Новый пароль', required=False )
password2 = forms.CharField( widget=forms.PasswordInput, label=u'Пароля (верификация)', required=False )
oldpassword = forms.CharField( widget=forms.PasswordInput, label='Old password', required=False )
password1 = forms.CharField( widget=forms.PasswordInput, label=u'New password', required=False )
password2 = forms.CharField( widget=forms.PasswordInput, label=u'New password (verification)', required=False )

class Meta(object):
model = User
Expand All @@ -64,27 +64,27 @@ class Meta(object):
def clean_oldpassword(self):
cd = self.cleaned_data
if cd.get('oldpassword') and not self.instance.check_password(cd['oldpassword']):
raise ValidationError(u'Неверный пароль.')
raise ValidationError(u'Invalid password.')
return cd['oldpassword']

def clean_password1(self):
cd = self.cleaned_data
if cd.get('oldpassword') != '' and cd.get('password1') == '':
raise ValidationError(u'Введите новый пароль')
raise ValidationError(u'Enter new password')
return cd['password1']


def clean_password2(self):
cd = self.cleaned_data
if cd.get('oldpassword') != '' and cd.get('password2') == '':
raise ValidationError(u'Введите новый пароль')
raise ValidationError(u'Enter new password')
if cd.get('password1') and cd['password1'] != cd['password2']:
raise ValidationError(u'Пароли не совпадают')
raise ValidationError(u'Passwords does not match')
return cd['password2']


class UserProfileForm(forms.ModelForm):
class Meta(object):
model = UserProfile
fields = ('avatar', 'gender', 'birth_date', 'about_me', )
# TODO: add editing for field 'use_gravatar'
# TODO: add editing for field 'use_gravatar'
106 changes: 53 additions & 53 deletions site/source/apps/techblog/functions.py
@@ -1,53 +1,53 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# For code highlight
import re
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.styles import get_style_by_name
from pygments.formatters import HtmlFormatter

def html_parser(value):
value = re.sub('(?is)(<script[^>]*>.*?</script[^>]*>|<link[^>/]*/?>)', '', value).strip() # cleaning
if value:
formatter = HtmlFormatter(nowrap=True, lineseparator='<br/>', style=get_style_by_name('native'))
def render_raw(match):
lexer = get_lexer_by_name(match.groups()[0])
return '<code class="highlight">%s</code>' % highlight(match.groups()[1], lexer, formatter)
value = re.sub('(?is)<code[^>]*language="(\w+)"[^>]*>(.*?)</code[^>]*>', render_raw, value)
return value

def int2bin(num):
res = []
while num:
res.append(num % 2)
num = num / 2
return res

def binary_date(date):
res = '<div class="day-line">'
for i in int2bin(date.day):
res += '<span class="bit-%d"></span>' % i
res += '</div><div class="month-line">'
for i in int2bin(date.month):
res += '<span class="bit-%d"></span>' % i
res += '</div><div class="year-line">'
for i in int2bin(date.year % 100):
res += '<span class="bit-%d"></span>' % i
res += '</div>'
return res

def formatted_date(date):
res = u"""
<span class="date-day">%d</span>
<span class="date-month">%s</span>
<span class="date-year">%d</span>
<span class="date-time">%s</span>
""" % (
date.day,
[u'Янв', u'Фев', u'Мар', u'Апр', u'Май', u'Июн', u'Июл', u'Авг', u'Сен', u'Окт', u'Ноя', u'Дек'][date.month - 1],
date.year,
date.time().strftime('%H:%M')
)
return res
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# For code highlight
import re
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.styles import get_style_by_name
from pygments.formatters import HtmlFormatter

def html_parser(value):
value = re.sub('(?is)(<script[^>]*>.*?</script[^>]*>|<link[^>/]*/?>)', '', value).strip() # cleaning
if value:
formatter = HtmlFormatter(nowrap=True, lineseparator='<br/>', style=get_style_by_name('native'))
def render_raw(match):
lexer = get_lexer_by_name(match.groups()[0])
return '<code class="highlight">%s</code>' % highlight(match.groups()[1], lexer, formatter)
value = re.sub('(?is)<code[^>]*language="(\w+)"[^>]*>(.*?)</code[^>]*>', render_raw, value)
return value

def int2bin(num):
res = []
while num:
res.append(num % 2)
num = num / 2
return res

def binary_date(date):
res = '<div class="day-line">'
for i in int2bin(date.day):
res += '<span class="bit-%d"></span>' % i
res += '</div><div class="month-line">'
for i in int2bin(date.month):
res += '<span class="bit-%d"></span>' % i
res += '</div><div class="year-line">'
for i in int2bin(date.year % 100):
res += '<span class="bit-%d"></span>' % i
res += '</div>'
return res

def formatted_date(date):
res = u"""
<span class="date-day">%d</span>
<span class="date-month">%s</span>
<span class="date-year">%d</span>
<span class="date-time">%s</span>
""" % (
date.day,
[u'Jan', u'Feb', u'Mar', u'Apr', u'May', u'Jun', u'Jul', u'Aug', u'Sep', u'Oct', u'Nov', u'Dec'][date.month - 1],
date.year,
date.time().strftime('%H:%M')
)
return res
6 changes: 3 additions & 3 deletions site/source/apps/techblog/logic/mail_service.py
Expand Up @@ -10,7 +10,7 @@ class MailService(object):
def send_mail_on_user_activate(request, user):
mail_users(
[],
u"Пользователь %s активирован" % user,
u"User '%s' have been activated" % user,
"mail/mail_user_activate.html",
{
"site_url": Site.objects.get_current(),
Expand All @@ -24,7 +24,7 @@ def send_mail_on_first_article_publish(article, user):
if not article.notified_on_first_publish:
mail_users(
[],
u"Пользователь %s опубликовал статью" % user,
u"User '%s' published the article" % user,
"mail/mail_article_publish.html",
{
"site_url": Site.objects.get_current(),
Expand All @@ -40,7 +40,7 @@ def send_mail_on_first_article_publish(article, user):
def send_mail_on_article_comment(comment):
mail_users(
[],
u"Новый комментарий от пользователя %s: " % comment.user,
u"New comment from user '%s': " % comment.user,
"mail/mail_article_comment.html",
{
"site_url": Site.objects.get_current(),
Expand Down
52 changes: 26 additions & 26 deletions site/source/apps/techblog/models.py
Expand Up @@ -29,12 +29,12 @@ def __unicode__(self):

class Category(models.Model):
class Meta:
verbose_name = u'Категория'
verbose_name_plural = u'Категории'
verbose_name = u'Category'
verbose_name_plural = u'Categories'
ordering = ('title',)

title = models.CharField(max_length=64, verbose_name=u'Заголовок')
slug = models.SlugField(max_length=64, verbose_name=u'Текстовая ссылка на статью в броузере', help_text=u'только анг.буквы, пример time_management_for_the_masses', default="")
title = models.CharField(max_length=64, verbose_name=u'Title')
slug = models.SlugField(max_length=64, verbose_name=u'Text link to the article in browser', help_text=u"only English letters, sample 'time_management_for_the_masses'", default="")

def __unicode__(self):
return self.title
Expand All @@ -48,15 +48,15 @@ def get_categories_with_count():

class Article(models.Model):
class Meta:
verbose_name = u'статья'
verbose_name_plural = u'Статьи'
verbose_name = u'Article'
verbose_name_plural = u'Articles'
ordering = ('-date',)

author = models.ForeignKey(User, verbose_name=u'Автор', null=True, blank=True)
authors = models.ManyToManyField(User, verbose_name=u'Авторы', null=True, related_name='authors')
title = models.CharField(u'Заголовок статьи', max_length=1024)
date = models.DateTimeField(u'Время публикации', default=datetime.now())
is_public = models.BooleanField(u'Статья опубликована?', default=False)
author = models.ForeignKey(User, verbose_name=u'Author', null=True, blank=True)
authors = models.ManyToManyField(User, verbose_name=u'Authors', null=True, related_name='authors')
title = models.CharField(u'Title', max_length=1024)
date = models.DateTimeField(u'Publication date', default=datetime.now())
is_public = models.BooleanField(u'Is published?', default=False)
notified_on_first_publish = models.BooleanField(default=False, editable=False)

lang = models.ForeignKey(Language, verbose_name=u'Language')
Expand All @@ -73,12 +73,12 @@ class Meta:
(MARKUP_RST, u'ReStructuredText'),
(MARKUP_TEXTILE, u'Textile'),
)
markup = models.CharField(u'Формат', max_length=16, default=MARKUP_HTML, choices=MARKUP_TYPE)
short_raw = models.TextField(u'Начало')
description_raw = models.TextField(u'Под катом', blank=True)
markup = models.CharField(u'Format', max_length=16, default=MARKUP_HTML, choices=MARKUP_TYPE)
short_raw = models.TextField(u'Short')
description_raw = models.TextField(u'Undercut', blank=True)

short = models.TextField(u'Начало (результат)')
description = models.TextField(u'Под катом (результат)', blank=True)
short = models.TextField(u'Short (result)')
description = models.TextField(u'Undercut (result)', blank=True)
tags = TaggableManager(blank=True)
category = models.ForeignKey(Category, null=True, blank=True)

Expand Down Expand Up @@ -126,22 +126,22 @@ class UserProfile(models.Model):
After profile is created you may access it from User instance: userobj.get_profile()
"""
class Meta:
verbose_name = u'профиль'
verbose_name_plural = u'Профили пользователей'
verbose_name = u'User profile'
verbose_name_plural = u'User profiles'

def __unicode__(self):
return u'Профиль пользователя %s' % self.user.username
return u"Profile of user: '%s'" % self.user.username

user = models.ForeignKey(User, unique=True)
GENDERS = (
(GENDER_MALE, u'Мужской'),
(GENDER_FEMALE, u'Женский'),
(GENDER_MALE, u'Male'),
(GENDER_FEMALE, u'Female'),
)
gender = models.CharField(u'Пол', max_length=16, choices=GENDERS, blank=True, null=True)
birth_date = models.DateField(u'Дата рождения', blank=True, null=True)
avatar = ImageField(u'Фото', blank=True, null=True, upload_to='users/')
use_gravatar = models.BooleanField(u'Использовать Gravatar', default=False)
about_me = models.TextField(u'Про себя', max_length=4096, blank=True, null=True)
gender = models.CharField(u'Gender', max_length=16, choices=GENDERS, blank=True, null=True)
birth_date = models.DateField(u'Birthday', blank=True, null=True)
avatar = ImageField(u'Foto', blank=True, null=True, upload_to='users/')
use_gravatar = models.BooleanField(u'Use Gravatar', default=False)
about_me = models.TextField(u'About me', max_length=4096, blank=True, null=True)

def get_articles_count(self):
count = Article.objects.filter( authors__in=[self.user], is_public=True).count()
Expand Down
4 changes: 2 additions & 2 deletions site/source/apps/techblog/services/articles.py
Expand Up @@ -170,9 +170,9 @@ def get_current_filters(self):
own = params.get('own')
if own:
if own == 'articles':
own = u'Статьи'
own = u'Articles'
elif own == 'drafts':
own = u'Черновики'
own = u'Drafts'

current_filters.append({
'name': 'own',
Expand Down

0 comments on commit b79334b

Please sign in to comment.