From 5e1616d83a61e36323461569f9186bb91a8af85c Mon Sep 17 00:00:00 2001 From: Stefano Brentegani Date: Wed, 30 Jul 2014 10:40:13 +0200 Subject: [PATCH 1/3] split blocktrans in templates --- .../helpdesk/confirm_delete_saved_query.html | 13 ++++++------- helpdesk/templates/helpdesk/create_ticket.html | 8 ++++---- helpdesk/templates/helpdesk/delete_ticket.html | 7 +++---- helpdesk/templates/helpdesk/edit_ticket.html | 6 +++--- helpdesk/templates/helpdesk/email_ignore_add.html | 8 ++++---- helpdesk/templates/helpdesk/email_ignore_del.html | 7 +++---- helpdesk/templates/helpdesk/public_homepage.html | 2 +- helpdesk/templates/helpdesk/public_spam.html | 13 ++++--------- helpdesk/templates/helpdesk/system_settings.html | 6 +++--- helpdesk/templates/helpdesk/user_settings.html | 8 +++----- 10 files changed, 34 insertions(+), 44 deletions(-) diff --git a/helpdesk/templates/helpdesk/confirm_delete_saved_query.html b/helpdesk/templates/helpdesk/confirm_delete_saved_query.html index 4b2b5787..6ba9b732 100644 --- a/helpdesk/templates/helpdesk/confirm_delete_saved_query.html +++ b/helpdesk/templates/helpdesk/confirm_delete_saved_query.html @@ -2,15 +2,14 @@ {% block helpdesk_title %}{% trans "Delete Saved Query" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans with query.title as query_title %} -

Delete Query

+{% block helpdesk_body %} +

{% trans "Delete Query" %}

-

Are you sure you want to delete this saved filter ({{ query_title }})? To re-create it, you will need to manually re-filter your ticket listing.

-{% endblocktrans %} +

{% blocktrans with query.title as query_title %}Are you sure you want to delete this saved filter ({{ query_title }})? To re-create it, you will need to manually re-filter your ticket listing.{% endblocktrans %}

-{% if query.shared %}{% blocktrans %} -

You have shared this query, so other users may be using it. If you delete it, they will have to manually create their own query.

-{% endblocktrans %}{% endif %} +{% if query.shared %} +

{% blocktrans %}You have shared this query, so other users may be using it. If you delete it, they will have to manually create their own query.{% endblocktrans %}

+{% endif %}

{% trans "No, Don't Delete It" %}

diff --git a/helpdesk/templates/helpdesk/create_ticket.html b/helpdesk/templates/helpdesk/create_ticket.html index f3caf81c..fbf63de1 100644 --- a/helpdesk/templates/helpdesk/create_ticket.html +++ b/helpdesk/templates/helpdesk/create_ticket.html @@ -6,9 +6,9 @@
-
{% blocktrans %}

Submit a Ticket

- -

Unless otherwise stated, all fields are required. Please provide as descriptive a title and description as possible.

{% endblocktrans %} +
+

{% trans "Submit a Ticket" %}

+

{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}

@@ -24,7 +24,7 @@ {% endif %} {% endfor %} {% endcomment %} - +
diff --git a/helpdesk/templates/helpdesk/delete_ticket.html b/helpdesk/templates/helpdesk/delete_ticket.html index c801f714..93209ad5 100644 --- a/helpdesk/templates/helpdesk/delete_ticket.html +++ b/helpdesk/templates/helpdesk/delete_ticket.html @@ -2,11 +2,10 @@ {% block helpdesk_title %}{% trans "Delete Ticket" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans with ticket.title as ticket_title %} -

Delete Ticket

+{% block helpdesk_body %} +

{% trans "Delete Ticket" %}

-

Are you sure you want to delete this ticket ({{ ticket_title }})? All traces of the ticket, including followups, attachments, and updates will be irreversably removed.

-{% endblocktrans %} +

{% blocktrans with ticket.title as ticket_title %}Are you sure you want to delete this ticket ({{ ticket_title }})? All traces of the ticket, including followups, attachments, and updates will be irreversibly removed.{% endblocktrans %}

{% trans "No, Don't Delete It" %}

diff --git a/helpdesk/templates/helpdesk/edit_ticket.html b/helpdesk/templates/helpdesk/edit_ticket.html index 0639df22..a3087c99 100644 --- a/helpdesk/templates/helpdesk/edit_ticket.html +++ b/helpdesk/templates/helpdesk/edit_ticket.html @@ -6,11 +6,11 @@
-
{% blocktrans %}

Edit a Ticket

+

{% trans "Edit a Ticket" %}

-

Unless otherwise stated, all fields are required. Please provide as descriptive a title and description as possible.

+

{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}

-

Note: Editing a ticket does not send an e-mail to the ticket owner or submitter. No new details should be entered, this form should only be used to fix incorrect details or clean up the submission.

{% endblocktrans %} +

{% trans "Note" %}: {% blocktrans %}Editing a ticket does not send an e-mail to the ticket owner or submitter. No new details should be entered, this form should only be used to fix incorrect details or clean up the submission.{% endblocktrans %}

diff --git a/helpdesk/templates/helpdesk/email_ignore_add.html b/helpdesk/templates/helpdesk/email_ignore_add.html index 68d94adc..f9865398 100644 --- a/helpdesk/templates/helpdesk/email_ignore_add.html +++ b/helpdesk/templates/helpdesk/email_ignore_add.html @@ -2,12 +2,12 @@ {% block helpdesk_title %}{% trans "Ignore E-Mail Address" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} -

Ignore E-Mail Address

+{% block helpdesk_body %} +

{% trans "Ignore E-Mail Address" %}

-

To ignore an e-mail address and prevent any emails from that address creating tickets automatically, enter the e-mail address below.

+

{% blocktrans %}To ignore an e-mail address and prevent any emails from that address creating tickets automatically, enter the e-mail address below.{% endblocktrans %}

-

You can either enter a whole e-mail address such as email@domain.com or a portion of an e-mail address with a wildcard, such as *@domain.com or user@*.

{% endblocktrans %} +

{% blocktrans %}You can either enter a whole e-mail address such as email@domain.com or a portion of an e-mail address with a wildcard, such as *@domain.com or user@*.{% endblocktrans %}

diff --git a/helpdesk/templates/helpdesk/email_ignore_del.html b/helpdesk/templates/helpdesk/email_ignore_del.html index 9f3fb0d5..a1ca4b33 100644 --- a/helpdesk/templates/helpdesk/email_ignore_del.html +++ b/helpdesk/templates/helpdesk/email_ignore_del.html @@ -2,11 +2,10 @@ {% block helpdesk_title %}{% trans "Delete Ignored E-Mail Address" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans with ignore.email_address as email_address %} -

Un-Ignore E-Mail Address

+{% block helpdesk_body %} +

{% trans "Un-Ignore E-Mail Address" %}

-

Are you sure you wish to stop removing this email address ({{ email_address }}) and allow their e-mails to automatically create tickets in your system? You can re-add this e-mail address at any time.

-{% endblocktrans %} +

{% blocktrans with ignore.email_address as email_address %}Are you sure you wish to stop removing this email address ({{ email_address }}) and allow their e-mails to automatically create tickets in your system? You can re-add this e-mail address at any time.{% endblocktrans %}

{% trans "Keep Ignoring It" %}

diff --git a/helpdesk/templates/helpdesk/public_homepage.html b/helpdesk/templates/helpdesk/public_homepage.html index 3cf00b03..d991f0f4 100644 --- a/helpdesk/templates/helpdesk/public_homepage.html +++ b/helpdesk/templates/helpdesk/public_homepage.html @@ -25,7 +25,7 @@

{% trans "Submit a Ticket" %}

-

{% trans "All fields are required. Please provide as descriptive a title and description as possible." %}

+

{% trans "All fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}

diff --git a/helpdesk/templates/helpdesk/public_spam.html b/helpdesk/templates/helpdesk/public_spam.html index ed05434c..0a83fb53 100644 --- a/helpdesk/templates/helpdesk/public_spam.html +++ b/helpdesk/templates/helpdesk/public_spam.html @@ -2,12 +2,7 @@ {% block helpdesk_body %}

{% trans "Unable To Open Ticket" %}

- -{% blocktrans %}

Sorry, but there has been an error trying to submit your ticket.

- -

Our system has marked your submission as spam, so we are unable to save it. If this is not spam, please press back and re-type your message. Be careful to avoid sounding 'spammy', and if you have heaps of links please try removing them if possible.

- -

We are sorry for any inconvenience, however this check is required to avoid our helpdesk resources being overloaded by spammers.

-{% endblocktrans %} - -{% endblock %} +

{% trans "Sorry, but there has been an error trying to submit your ticket." %}

+

{% blocktrans %}Our system has marked your submission as spam, so we are unable to save it. If this is not spam, please press back and re-type your message. Be careful to avoid sounding 'spammy', and if you have heaps of links please try removing them if possible.{% endblocktrans %}

+

{% blocktrans %}We are sorry for any inconvenience, however this check is required to avoid our helpdesk resources being overloaded by spammers.{% endblocktrans %}

+{% endblock helpdesk_body %} diff --git a/helpdesk/templates/helpdesk/system_settings.html b/helpdesk/templates/helpdesk/system_settings.html index f2c2c1cb..bead3bdb 100644 --- a/helpdesk/templates/helpdesk/system_settings.html +++ b/helpdesk/templates/helpdesk/system_settings.html @@ -2,10 +2,10 @@ {% block helpdesk_title %}{% trans "Change System Settings" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} -

System Settings

+{% block helpdesk_body %} +

{% trans "System Settings" %}

-

The following items can be maintained by you or other superusers:

{% endblocktrans %} +

{% blocktrans %}The following items can be maintained by you or other superusers:{% endblocktrans %}

  • {% trans "E-Mail Ignore list" %}
  • diff --git a/helpdesk/templates/helpdesk/user_settings.html b/helpdesk/templates/helpdesk/user_settings.html index 843cae55..50424995 100644 --- a/helpdesk/templates/helpdesk/user_settings.html +++ b/helpdesk/templates/helpdesk/user_settings.html @@ -3,11 +3,9 @@ {% block helpdesk_title %}{% trans "Change User Settings" %}{% endblock %} {% block helpdesk_body %} -{% blocktrans %} -

    User Settings

    +

    {% trans "User Settings" %}

    -

    Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.

    -{% endblocktrans %} +

    {% blocktrans %}Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.{% endblocktrans %}

    {% csrf_token %} @@ -17,4 +15,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} From 94fa283f2dcc9b0b3e1984572389c33caeba6954 Mon Sep 17 00:00:00 2001 From: Stefano Brentegani Date: Wed, 30 Jul 2014 10:41:10 +0200 Subject: [PATCH 2/3] mark new translatable strings and reduce redundancy --- helpdesk/models.py | 78 ++++++++++++++++----- helpdesk/templates/helpdesk/navigation.html | 4 +- helpdesk/templates/helpdesk/ticket.html | 4 +- 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/helpdesk/models.py b/helpdesk/models.py index e0c8e6c8..1f6f64b3 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -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') diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index 05fa27dd..59bc3f0d 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -62,10 +62,10 @@