Commit 80691ea3 authored by Michal Čihař's avatar Michal Čihař

Better approach for defining language in translations

parent 09609f8f
......@@ -32,12 +32,7 @@
{% blocktrans %}{{ project }} is being translated using <a href="http://weblate.org/">Weblate</a>, a web tool designed to ease translating for both developers and translators.{% endblocktrans %}
</p>
<p>
{% if language %}
{% comment %}Translators: please use your language name instead of %(language_name)s{% endcomment %}
{% blocktrans with language.name as language_name %}<a href="{{ url }}">Translation project for {{ project }}</a> into {{ language_name }} currently contains {{ total }} strings for translation and is {{ percent }}% complete.{% endblocktrans %}
{% else %}
{% blocktrans %}<a href="{{ url }}">Translation project for {{ project }}</a> currently contains {{ total }} strings for translation and is <a href="{{ url }}">being translated into {{ languages }} languages</a>. Overall, these translations are {{ percent }}% complete.{% endblocktrans %}
{% endif %}
{{ status_text }}
</p>
<p>
{% url 'weblate_register' as reg_url %}
......
......@@ -33,6 +33,7 @@ from django.db.models import Q, Count, Sum
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.utils.safestring import mark_safe
from weblate.trans.models import Project, SubProject, Translation, Unit, Suggestion, Check, Dictionary, Change, Comment, get_versions
from weblate.lang.models import Language
......@@ -382,7 +383,7 @@ def show_engage(request, project, lang = None):
except Language.DoesNotExist:
pass
return render_to_response('engage.html', RequestContext(request, {
context = {
'object': obj,
'project': obj.name,
'languages': obj.get_language_count(),
......@@ -390,7 +391,20 @@ def show_engage(request, project, lang = None):
'percent': obj.get_translated_percent(language),
'url': obj.get_absolute_url(),
'language': language,
}))
}
# Render text
if language is None:
status_text = _('<a href="%(url)s">Translation project for %(project)s</a> currently contains %(total)s strings for translation and is <a href="%(url)s">being translated into %(languages)s languages</a>. Overall, these translations are %(percent)s%% complete.')
else:
# Translators: line of text in engagement widget, please use your language name instead of English
status_text = _('<a href="%(url)s">Translation project for %(project)s</a> into English currently contains %(total)s strings for translation and is %(percent)s%% complete.')
if 'English' in status_text:
status_text = status_text.replace('English', language.name)
context['status_text'] = mark_safe(status_text % context)
return render_to_response('engage.html', RequestContext(request, context))
def show_project(request, project):
obj = get_object_or_404(Project, slug = project)
......
......@@ -77,8 +77,8 @@ WIDGETS = {
{
# Translators: line of text in engagement widget
'text': ugettext_lazy("translating %(count)d strings into %(languages)d languages"),
# Translators: line of text in engagement widget, please use your language name instead of %(language_name)s
'text_lang': ugettext_lazy("translating %(count)d strings into %(language_name)s"),
# Translators: line of text in engagement widget, please use your language name instead of English
'text_lang': ugettext_lazy("translating %(count)d strings into English"),
'font': ("Sans", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL),
'font_size': 10,
'pos': (72, 32),
......@@ -266,8 +266,6 @@ def render(request, project, widget = '287x66', color = None):
'languages': obj.get_language_count(),
'percent': percent,
}
if lang is not None:
params['language_name'] = lang.name
for line in widget_data['text']:
ctx.move_to(*line['pos'])
......@@ -276,6 +274,8 @@ def render(request, project, widget = '287x66', color = None):
text = line['text']
if lang is not None and 'text_lang' in line:
text = line['text_lang']
if 'English' in text:
text = text.replace('English', lang.name)
ctx.text_path(text % params)
ctx.fill()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment