Fixes Issue #117 thanks to hgeerts. Corrects usage of blocktrans tag,

and properly concatenates strings together in models.py
This commit is contained in:
Ross Poulton 2009-10-13 10:28:42 +00:00
parent ea1610e837
commit 2705880f82
3 changed files with 14 additions and 11 deletions

View File

@ -13,3 +13,6 @@ being used, no change is visible to the user.
2009-10-13 r141 Issue #118 Incorrect locale handling on email templates 2009-10-13 r141 Issue #118 Incorrect locale handling on email templates
Patch courtesy of hgeerts. Corrects the handling of locale on email Patch courtesy of hgeerts. Corrects the handling of locale on email
templaets, defaulting to English if no locale is provided. templaets, defaulting to English if no locale is provided.
2009-10-13 r142 Issue #117 Incorrect I18N usage in a few spots
Patch thanks to hgeerts.

View File

@ -12,7 +12,7 @@ from datetime import datetime
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _, ugettext
from helpdesk.settings import HAS_TAG_SUPPORT from helpdesk.settings import HAS_TAG_SUPPORT
if HAS_TAG_SUPPORT: if HAS_TAG_SUPPORT:
@ -536,16 +536,16 @@ class TicketChange(models.Model):
) )
def __unicode__(self): def __unicode__(self):
str = u'%s ' % field str = u'%s ' % self.field
if not new_value: if not self.new_value:
str += _('removed') str += ugettext('removed')
elif not old_value: elif not self.old_value:
str += _('set to %s' % new_value) str += ugettext('set to %s') % self.new_value
else: else:
str += _('changed from "%(old_value)s" to "%(new_value)s"' % { str += ugettext('changed from "%(old_value)s" to "%(new_value)s"') % {
'old_value': old_value, 'old_value': self.old_value,
'new_value': new_value 'new_value': self.new_value
}) }
return str return str

View File

@ -54,7 +54,7 @@
{{ followup.comment|force_escape|num_to_link|linebreaksbr }} {{ followup.comment|force_escape|num_to_link|linebreaksbr }}
{% if followup.ticketchange_set.all %}<div class='changes'><ul> {% if followup.ticketchange_set.all %}<div class='changes'><ul>
{% for change in followup.ticketchange_set.all %} {% for change in followup.ticketchange_set.all %}
<li>{% blocktrans %}Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.{% endblocktrans %}</li> <li>{% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}</li>
{% endfor %} {% endfor %}
{% for attachment in followup.attachment_set.all %}{% if forloop.first %}<div class='attachments'><ul>{% endif %} {% for attachment in followup.attachment_set.all %}{% if forloop.first %}<div class='attachments'><ul>{% endif %}
<li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})</li> <li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})</li>