From 654715519359cdeff47dc19a30166b490caacd6b Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sat, 10 Jun 2017 19:57:46 +0200 Subject: [PATCH 01/10] Use blocktrans with count instead of manually counting --- .../templates/projects/project_dashboard_base.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readthedocs/templates/projects/project_dashboard_base.html b/readthedocs/templates/projects/project_dashboard_base.html index 1c9b1339782..53560582fc1 100644 --- a/readthedocs/templates/projects/project_dashboard_base.html +++ b/readthedocs/templates/projects/project_dashboard_base.html @@ -74,11 +74,11 @@

{% trans "Projects" %}

{% else %} - {% if builds == 1 %} - {% trans "1 build" %} - {% else %} - {{ builds }} {% trans "builds" %} - {% endif %} + {% blocktrans count counter=builds %} + 1 build + {% plural %} + {{ builds }} builds + {% endblocktrans %} {% with build=project.get_latest_build %} {% if build.success %} From 317cd944fcf88f5ec811fdb19c9d63a52b30493e Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sat, 10 Jun 2017 20:22:44 +0200 Subject: [PATCH 02/10] Add context to separate 2 different uses of the same word --- readthedocs/donate/models.py | 8 ++++++-- readthedocs/templates/projects/project_import.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/readthedocs/donate/models.py b/readthedocs/donate/models.py index 7066ffca05a..4237c0af93c 100644 --- a/readthedocs/donate/models.py +++ b/readthedocs/donate/models.py @@ -4,7 +4,7 @@ from django.db import models from django.utils.crypto import get_random_string -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _, pgettext from django.core.urlresolvers import reverse from django.conf import settings @@ -172,9 +172,13 @@ def report_html_text(self): class BaseImpression(models.Model): + + """Statistics for tracking.""" + date = models.DateField(_('Date')) offers = models.IntegerField(_('Offer'), default=0) - views = models.IntegerField(_('View'), default=0) + views = models.IntegerField( + pgettext('View', 'Number of display on a screen that were sold'), default=0) clicks = models.IntegerField(_('Clicks'), default=0) class Meta: diff --git a/readthedocs/templates/projects/project_import.html b/readthedocs/templates/projects/project_import.html index f17ad2bc213..cc3d0b40dbe 100644 --- a/readthedocs/templates/projects/project_import.html +++ b/readthedocs/templates/projects/project_import.html @@ -163,7 +163,7 @@

{% trans "Import a Repository" %}

data-bind="attr: {href: url}" class="remote-repo-view" title="{% trans "This repository has already been imported" %}"> - {% trans "View" %} + {% blocktrans context "verb, action to see in detail" %}"View"{% endblocktrans %}
  • From 9abf84461c04e680910c230e30a5a94e120b0e74 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sat, 10 Jun 2017 21:16:44 +0200 Subject: [PATCH 03/10] Translate untranslated string with consistency and pluralization --- readthedocs/gold/templates/gold/projects.html | 6 +++++- readthedocs/gold/templates/gold/subscription_detail.html | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/readthedocs/gold/templates/gold/projects.html b/readthedocs/gold/templates/gold/projects.html index 63a4bf76fed..e78805f74ea 100644 --- a/readthedocs/gold/templates/gold/projects.html +++ b/readthedocs/gold/templates/gold/projects.html @@ -26,7 +26,11 @@

    {% trans "Existing Projects" %}

    - You can adopt {{ gold_user.num_supported_projects }} projects with your subscription. + {% blocktrans count projects=gold_user.num_supported_projects %} + You can adopt one project with your subscription. + {% plural %} + You can adopt {{ projects }} projects with your subscription. + {% endblocktrans %}

      diff --git a/readthedocs/gold/templates/gold/subscription_detail.html b/readthedocs/gold/templates/gold/subscription_detail.html index a25d3391a84..90bbf1410ed 100644 --- a/readthedocs/gold/templates/gold/subscription_detail.html +++ b/readthedocs/gold/templates/gold/subscription_detail.html @@ -56,7 +56,9 @@

      {% trans "Gold Subscription" %}

      {% trans "Projects" %}

      - {% blocktrans with projects=golduser.num_supported_projects %} + {% blocktrans count projects=golduser.num_supported_projects %} + You can adopt one project with your subscription. + {% plural %} You can adopt {{ projects }} projects with your subscription. {% endblocktrans %}

      From b9345684507f63245ab1da26d4de42af6cd3edda Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 11:29:06 +0200 Subject: [PATCH 04/10] Remove parts that should not be translated --- readthedocs/redirects/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readthedocs/redirects/models.py b/readthedocs/redirects/models.py index 238ee90a3da..1b078f98fb1 100644 --- a/readthedocs/redirects/models.py +++ b/readthedocs/redirects/models.py @@ -75,11 +75,11 @@ class Meta: def __unicode__(self): if self.redirect_type == 'prefix': - return ugettext('Prefix Redirect: %s ->' % self.from_url) + return ugettext('Prefix Redirect:') + ' %s ->' % self.from_url elif self.redirect_type == 'page': - return ugettext('Page Redirect: %s -> %s' % ( + return ugettext('Page Redirect:') + ' %s -> %s' % ( self.from_url, - self.to_url)) + self.to_url) else: return ugettext('Redirect: %s' % self.get_redirect_type_display()) From 8655cac13602ee77a1abacb7c9bb33076ba4abd2 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 11:41:07 +0200 Subject: [PATCH 05/10] Split translation block --- .../account/email/email_confirmation_message.html | 9 +++------ .../account/email/email_confirmation_message.txt | 10 ++++------ .../account/email/password_reset_key_message.html | 8 +++----- .../account/email/password_reset_key_message.txt | 10 +++++----- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/readthedocs/templates/account/email/email_confirmation_message.html b/readthedocs/templates/account/email/email_confirmation_message.html index 2b539356957..bc37aa55a8e 100644 --- a/readthedocs/templates/account/email/email_confirmation_message.html +++ b/readthedocs/templates/account/email/email_confirmation_message.html @@ -3,10 +3,8 @@ {% load i18n %} {% block content %} - {% blocktrans %}

      - To complete setting up your account, please verify this email address by - going to: + {% trans "To verify your email address and finish setting up your account, please go to:" %}

      @@ -14,8 +12,7 @@

      - If you did not sign up for an account with Read the Docs, you can - disregard this email. + {% trans "If you did not sign up for an account with Read the Docs, you can disregard this email." %}

      - {% endblocktrans %} {% endblock %} + diff --git a/readthedocs/templates/account/email/email_confirmation_message.txt b/readthedocs/templates/account/email/email_confirmation_message.txt index d88d010f577..46a7ca38fc5 100644 --- a/readthedocs/templates/account/email/email_confirmation_message.txt +++ b/readthedocs/templates/account/email/email_confirmation_message.txt @@ -2,12 +2,10 @@ {% load i18n %} -{% block content %}{% blocktrans %} -To verify your email address and finish setting up your account, please -go to: +{% block content %} +{% trans "To verify your email address and finish setting up your account, please go to:" %} {{ activate_url }} -If you did not sign up for an account with Read the Docs, you can -disregard this email. -{% endblocktrans %}{% endblock %} +{% trans "If you did not sign up for an account with Read the Docs, you can disregard this email." %} +{% endblock %} diff --git a/readthedocs/templates/account/email/password_reset_key_message.html b/readthedocs/templates/account/email/password_reset_key_message.html index 31bc1313061..424e846c20d 100644 --- a/readthedocs/templates/account/email/password_reset_key_message.html +++ b/readthedocs/templates/account/email/password_reset_key_message.html @@ -3,10 +3,9 @@ {% load i18n %} {% block content %} - {% blocktrans %}

      - A request has been made to reset your Read the Docs password. To confirm - this reset request, please go to: + {% trans "A request has been made to reset your Read the Docs password. To confirm +this reset request, please go to:" %}

      @@ -14,7 +13,6 @@

      - If you did not request to reset you password, you can disregard this email. + {% trans "If you did not request to reset you password, you can disregard this email." %}

      - {% endblocktrans %} {% endblock %} diff --git a/readthedocs/templates/account/email/password_reset_key_message.txt b/readthedocs/templates/account/email/password_reset_key_message.txt index b63c69bb6e4..507e688b760 100644 --- a/readthedocs/templates/account/email/password_reset_key_message.txt +++ b/readthedocs/templates/account/email/password_reset_key_message.txt @@ -2,11 +2,11 @@ {% load i18n %} -{% block content %}{% blocktrans %} -A request has been made to reset your Read the Docs password. To confirm -this reset request, please go to: +{% block content %} +{% trans "A request has been made to reset your Read the Docs password. To confirm +this reset request, please go to:" %} {{ password_reset_url }} -If you did not request to reset you password, you can disregard this email. -{% endblocktrans %}{% endblock %} +{% trans "If you did not request to reset you password, you can disregard this email." %} +{% endblock %} From bc03805b078057955f577c98f5548cd28587510d Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 12:08:12 +0200 Subject: [PATCH 06/10] No
      inside a single translation key. --- readthedocs/templates/core/project_bar_base.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/readthedocs/templates/core/project_bar_base.html b/readthedocs/templates/core/project_bar_base.html index be6be61dcb6..1224442eed4 100644 --- a/readthedocs/templates/core/project_bar_base.html +++ b/readthedocs/templates/core/project_bar_base.html @@ -32,7 +32,9 @@

      {% blocktrans %} This repository doesn't have a valid webhook set up, commits won't trigger new builds for this project. + {% endblocktrans %}
      + {% blocktrans %} See your project integrations for more information. {% endblocktrans %}

      @@ -40,11 +42,11 @@

      {% if project.skip %}

      - {% blocktrans %} + {% blocktrans %} Your project is currently disabled for abuse of the system. Please make sure it isn't using unreasonable amounts of resources or triggering lots of builds in a short amount of time. Please file a ticket to get your project re-enabled. - {% endblocktrans %} + {% endblocktrans %}


      {% endif %} From d7069b99c0f6b02968ef2db1d2bc9f58703012a9 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 12:10:32 +0200 Subject: [PATCH 07/10] Useless translation --- readthedocs/templates/core/project_details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index 2d2de01fb4c..140251829d8 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -35,7 +35,7 @@

      {% trans "Versions" %}

      {% else %} - {% blocktrans with version.slug as slug %} {{ slug }}{% endblocktrans %} + {{ slug }} {% endif %} {% if request.user|is_admin:project %} From 99cb2a0f01036b6c96f4e784b0eea6eaac1c5af9 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 12:21:27 +0200 Subject: [PATCH 08/10] Missing pluralization --- .../templates/notifications/send_notification_form.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/readthedocs/templates/notifications/send_notification_form.html b/readthedocs/templates/notifications/send_notification_form.html index b011a55892e..4551c1d8788 100644 --- a/readthedocs/templates/notifications/send_notification_form.html +++ b/readthedocs/templates/notifications/send_notification_form.html @@ -18,8 +18,10 @@

      {% trans 'Send Email' %}

      {% with extra_recipients=recipients|slice:"20:" %} {% if extra_recipients|length > 0 %}
    • - {% blocktrans with count=extra_recipients|length %} - And {{ count }} other recipients... + {% blocktrans count counter=extra_recipients|length %} + And 1 other recipient. + {% plural %} + And {{ counter }} other recipients... {% endblocktrans %}
    • {% endif %} From 88b6cc417db95ae73e004c67ae08a5a7403b89c9 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 12:53:59 +0200 Subject: [PATCH 09/10]

      outisde of blocktrans --- readthedocs/templates/projects/project_import.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readthedocs/templates/projects/project_import.html b/readthedocs/templates/projects/project_import.html index cc3d0b40dbe..f6067ce713f 100644 --- a/readthedocs/templates/projects/project_import.html +++ b/readthedocs/templates/projects/project_import.html @@ -79,12 +79,12 @@

      {% trans "Import a Repository" %}

      class="remote-repos-empty">
    • {% if has_connected_accounts %} - {% blocktrans with binding='data-bind="click: sync_projects"' trimmed %} -

      +

      + {% blocktrans with binding='data-bind="click: sync_projects"' trimmed %} No remote repositories found, try refreshing your accounts. -

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

      {% else %}

      {% blocktrans trimmed %} From 0c2e06f6112496404ea0311991086b5b0ca46d27 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Sun, 11 Jun 2017 16:05:29 +0200 Subject: [PATCH 10/10] Not translating the brand name --- readthedocs/templates/base.html | 2 +- readthedocs/templates/core/email/base.html | 2 +- readthedocs/templates/core/header.html | 4 ++-- readthedocs/templates/core/home-header.html | 2 +- readthedocs/templates/error_header.html | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/readthedocs/templates/base.html b/readthedocs/templates/base.html index 8e49b323d0e..b85ba03e070 100644 --- a/readthedocs/templates/base.html +++ b/readthedocs/templates/base.html @@ -11,7 +11,7 @@ - {% block title %}{% endblock %}{% block head_title %}{% endblock %} | {% block branding %}{% trans "Read the Docs" %} {% endblock %} + {% block title %}{% endblock %}{% block head_title %}{% endblock %} | {% block branding %}Read the Docs {% endblock %} diff --git a/readthedocs/templates/core/email/base.html b/readthedocs/templates/core/email/base.html index 559359fb9ab..65110ca7fe1 100644 --- a/readthedocs/templates/core/email/base.html +++ b/readthedocs/templates/core/email/base.html @@ -4,7 +4,7 @@ - {% trans "Read the Docs" %} + Read the Docs