mark new translatable strings and reduce redundancy

This commit is contained in:
Stefano Brentegani 2014-07-30 10:41:10 +02:00
parent 5e1616d83a
commit 94fa283f2d
3 changed files with 65 additions and 21 deletions

View File

@ -187,6 +187,8 @@ class Queue(models.Model):
class Meta:
ordering = ('title',)
verbose_name = _('Queue')
verbose_name_plural = _('Queues')
def _from_address(self):
"""
@ -244,7 +246,7 @@ class Ticket(models.Model):
(REOPENED_STATUS, _('Reopened')),
(RESOLVED_STATUS, _('Resolved')),
(CLOSED_STATUS, _('Closed')),
(DUPLICATE_STATUS, _('Duplicate')),
(DUPLICATE_STATUS, _('Duplicate')),
)
PRIORITY_CHOICES = (
@ -443,6 +445,8 @@ class Ticket(models.Model):
class Meta:
get_latest_by = "created"
ordering = ('id',)
verbose_name = _('Ticket')
verbose_name_plural = _('Tickets')
def __unicode__(self):
return u'%s %s' % (self.id, self.title)
@ -491,7 +495,7 @@ class FollowUp(models.Model):
)
date = models.DateTimeField(
_('Date'),
_('Date'),
default = timezone.now()
)
@ -535,6 +539,8 @@ class FollowUp(models.Model):
class Meta:
ordering = ['date']
verbose_name = _('Follow-up')
verbose_name_plural = _('Follow-ups')
def __unicode__(self):
return u'%s' % self.title
@ -590,6 +596,10 @@ class TicketChange(models.Model):
}
return str
class Meta:
verbose_name = _('Ticket change')
verbose_name_plural = _('Ticket changes')
def attachment_path(instance, filename):
"""
@ -652,6 +662,8 @@ class Attachment(models.Model):
class Meta:
ordering = ['filename',]
verbose_name = _('Attachment')
verbose_name_plural = _('Attachments')
class PreSetReply(models.Model):
@ -690,6 +702,8 @@ class PreSetReply(models.Model):
class Meta:
ordering = ['name',]
verbose_name = _('Pre-set reply')
verbose_name_plural = _('Pre-set replies')
def __unicode__(self):
return u'%s' % self.name
@ -728,6 +742,10 @@ class EscalationExclusion(models.Model):
def __unicode__(self):
return u'%s' % self.name
class Meta:
verbose_name = _('Escalation exclusion')
verbose_name_plural = _('Escalation exclusions')
class EmailTemplate(models.Model):
"""
@ -771,7 +789,7 @@ class EmailTemplate(models.Model):
help_text=_('The same context is available here as in plain_text, '
'above.'),
)
locale = models.CharField(
_('Locale'),
max_length=10,
@ -785,6 +803,8 @@ class EmailTemplate(models.Model):
class Meta:
ordering = ['template_name', 'locale']
verbose_name = _('e-mail template')
verbose_name_plural = _('e-mail templates')
class KBCategory(models.Model):
@ -811,6 +831,8 @@ class KBCategory(models.Model):
class Meta:
ordering = ['title',]
verbose_name = _('Knowledge base category')
verbose_name_plural = _('Knowledge base categories')
def get_absolute_url(self):
return ('helpdesk_kb_category', (), {'slug': self.slug})
@ -876,6 +898,8 @@ class KBItem(models.Model):
class Meta:
ordering = ['title',]
verbose_name = _('Knowledge base item')
verbose_name_plural = _('Knowledge base items')
def get_absolute_url(self):
return ('helpdesk_kb_item', (self.id,))
@ -885,7 +909,7 @@ class KBItem(models.Model):
class SavedSearch(models.Model):
"""
Allow a user to save a ticket search, eg their filtering and sorting
options, and optionally share it with other users. This lets people
options, and optionally share it with other users. This lets people
easily create a set of commonly-used filters, such as:
* My tickets waiting on me
* My tickets waiting on submitter
@ -922,10 +946,15 @@ class SavedSearch(models.Model):
else:
return u'%s' % self.title
class Meta:
verbose_name = _('Saved search')
verbose_name_plural = _('Saved searches')
class UserSettings(models.Model):
"""
A bunch of user-specific settings that we want to be able to define, such
as notification preferences and other things that should probably be
as notification preferences and other things that should probably be
configurable.
We should always refer to user.usersettings.settings['setting_name'].
@ -961,13 +990,13 @@ class UserSettings(models.Model):
return u'Preferences for %s' % self.user
class Meta:
verbose_name = 'User Settings'
verbose_name_plural = 'User Settings'
verbose_name = _('User Setting')
verbose_name_plural = _('User Settings')
def create_usersettings(sender, created_models=[], instance=None, created=False, **kwargs):
"""
Helper function to create UserSettings instances as
Helper function to create UserSettings instances as
required, eg when we first create the UserSettings database
table via 'syncdb' or when we save a new user.
@ -982,7 +1011,7 @@ def create_usersettings(sender, created_models=[], instance=None, created=False,
elif UserSettings in created_models:
# We just created the UserSettings model, lets create a UserSettings
# entry for each existing user. This will only happen once (at install
# time, or at upgrade) when the UserSettings model doesn't already
# time, or at upgrade) when the UserSettings model doesn't already
# exist.
for u in User.objects.all():
try:
@ -996,8 +1025,8 @@ models.signals.post_save.connect(create_usersettings, sender=User)
class IgnoreEmail(models.Model):
"""
This model lets us easily ignore e-mails from certain senders when
processing IMAP and POP3 mailboxes, eg mails from postmaster or from
This model lets us easily ignore e-mails from certain senders when
processing IMAP and POP3 mailboxes, eg mails from postmaster or from
known trouble-makers.
"""
queues = models.ManyToManyField(
@ -1068,13 +1097,18 @@ class IgnoreEmail(models.Model):
else:
return False
class Meta:
verbose_name = _('Ignored e-mail address')
verbose_name_plural = _('Ignored e-mail addresses')
class TicketCC(models.Model):
"""
Often, there are people who wish to follow a ticket who aren't the
Often, there are people who wish to follow a ticket who aren't the
person who originally submitted it. This model provides a way for those
people to follow a ticket.
In this circumstance, a 'person' could be either an e-mail address or
In this circumstance, a 'person' could be either an e-mail address or
an existing system user.
"""
@ -1191,12 +1225,12 @@ class CustomField(models.Model):
blank=True,
null=True,
)
empty_selection_list = models.BooleanField(
_('Add empty first choice to List?'),
default=False,
help_text=_('Only for List: adds an empty first entry to the choices list, which enforces that the user makes an active choice.'),
)
)
list_values = models.TextField(
_('List Values'),
@ -1204,7 +1238,7 @@ class CustomField(models.Model):
blank=True,
null=True,
)
ordering = models.IntegerField(
_('Ordering'),
help_text=_('Lower numbers are displayed first; higher numbers are listed later'),
@ -1235,6 +1269,10 @@ class CustomField(models.Model):
def __unicode__(self):
return '%s' % (self.name)
class Meta:
verbose_name = _('Custom field')
verbose_name_plural = _('Custom fields')
class TicketCustomFieldValue(models.Model):
ticket = models.ForeignKey(
@ -1255,11 +1293,15 @@ class TicketCustomFieldValue(models.Model):
class Meta:
unique_together = ('ticket', 'field'),
class Meta:
verbose_name = _('Ticket custom field value')
verbose_name_plural = _('Ticket custom field values')
class TicketDependency(models.Model):
"""
The ticket identified by `ticket` cannot be resolved until the ticket in `depends_on` has been resolved.
To help enforce this, a helper function `can_be_resolved` on each Ticket instance checks that
To help enforce this, a helper function `can_be_resolved` on each Ticket instance checks that
these have all been resolved.
"""
ticket = models.ForeignKey(
@ -1279,3 +1321,5 @@ class TicketDependency(models.Model):
class Meta:
unique_together = ('ticket', 'depends_on')
verbose_name = _('Ticket dependency')
verbose_name_plural = _('Ticket dependencies')

View File

@ -62,10 +62,10 @@
<ul id="dropdown" class="nav navbar-nav">
{% if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE %}
<li><a href='{% url 'helpdesk_dashboard' %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url 'helpdesk_submit' %}'>{% trans "Submit A Ticket" %}</a></li>
<li><a href='{% url 'helpdesk_submit' %}'>{% trans "Submit a Ticket" %}</a></li>
{% else %}
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
<li><a href='{% url 'helpdesk_home' %}'>{% trans "Submit A Ticket" %}</a></li>
<li><a href='{% url 'helpdesk_home' %}'>{% trans "Submit a Ticket" %}</a></li>
{% endif %}
{% endif %}
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url 'helpdesk_kb_index' %}'>{% trans "Knowledgebase" %}</a></li>{% endif %}

View File

@ -123,7 +123,7 @@ function googleTranslateElementInit() {
<fieldset>
<dl>
{% if preset_replies %}
<dt><label for='id_preset'>{% trans "Use a Pre-set Reply" %}</label> <span class='form_optional'>(Optional)</span></dt>
<dt><label for='id_preset'>{% trans "Use a Pre-set Reply" %}</label> <span class='form_optional'>{% trans "(Optional)" %}</span></dt>
<dd><select name='preset' id='id_preset'><option value=''>------</option>{% for preset in preset_replies %}<option value='{{ preset.id }}'>{{ preset.name }}</option>{% endfor %}</select></dd>
<dd class='form_help_text'>{% trans "Selecting a pre-set reply will over-write your comment below. You can then modify the pre-set reply to your liking before saving this update." %}</dd>
{% endif %}
@ -163,7 +163,7 @@ function googleTranslateElementInit() {
{% if helpdesk_settings.HELPDESK_UPDATE_PUBLIC_DEFAULT %}
<input type='hidden' name='public' value='1'>
{% else %}
<dt><label for='id_public'>{% trans "Is this update public?" %}</label> <span class='form_optional'>(Optional)</span></dt>
<dt><label for='id_public'>{% trans "Is this update public?" %}</label> <span class='form_optional'>{% trans "(Optional)" %}</span></dt>
<dd><input type='checkbox' name='public' value='1' checked='checked' /></dd>
<dd class='form_help_text'>{% trans "If this is public, the submitter will be e-mailed your comment or resolution." %}</dd>
{% endif %}