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 %}
- {% 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 %}
- 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 %}