diff options
12 files changed, 56 insertions, 49 deletions
diff --git a/django/contrib/comments/templates/comments/approve.html b/django/contrib/comments/templates/comments/approve.html index e07f74eedf..3bc8d2bd6c 100644 --- a/django/contrib/comments/templates/comments/approve.html +++ b/django/contrib/comments/templates/comments/approve.html @@ -1,14 +1,15 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Approve a comment{% endblock %} +{% block title %}{% trans "Approve a comment" %}{% endblock %} {% block content %} - <h1>Really make this comment public?</h1> + <h1>{% trans "Really make this comment public?" %}</h1> <blockquote>{{ comment|linebreaks }}</blockquote> <form action="." method="post"> <input type="hidden" name="next" value="{{ next }}" id="next" /> <p class="submit"> - <input type="submit" name="submit" value="Approve" /> or <a href="{{ comment.permalink }}">cancel</a> + <input type="submit" name="submit" value="{% trans "Approve" %}" /> or <a href="{{ comment.permalink }}">cancel</a> </p> </form> {% endblock %} diff --git a/django/contrib/comments/templates/comments/approved.html b/django/contrib/comments/templates/comments/approved.html index 1ff5c42896..d4ba245465 100644 --- a/django/contrib/comments/templates/comments/approved.html +++ b/django/contrib/comments/templates/comments/approved.html @@ -1,7 +1,8 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Thanks for approving.{% endblock %} +{% block title %}{% trans "Thanks for approving" %}.{% endblock %} {% block content %} - <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> -{% endblock %}
\ No newline at end of file + <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> +{% endblock %} diff --git a/django/contrib/comments/templates/comments/delete.html b/django/contrib/comments/templates/comments/delete.html index 917a638bc3..1e7d248c51 100644 --- a/django/contrib/comments/templates/comments/delete.html +++ b/django/contrib/comments/templates/comments/delete.html @@ -1,14 +1,15 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Remove a comment{% endblock %} +{% block title %}{% trans "Remove a comment" %}{% endblock %} {% block content %} - <h1>Really remove this comment?</h1> +<h1>{% trans "Really remove this comment?" %}</h1> <blockquote>{{ comment|linebreaks }}</blockquote> <form action="." method="post"> <input type="hidden" name="next" value="{{ next }}" id="next" /> <p class="submit"> - <input type="submit" name="submit" value="Remove" /> or <a href="{{ comment.permalink }}">cancel</a> + <input type="submit" name="submit" value="{% trans "Remove" %}" /> or <a href="{{ comment.permalink }}">cancel</a> </p> </form> {% endblock %} diff --git a/django/contrib/comments/templates/comments/deleted.html b/django/contrib/comments/templates/comments/deleted.html index 9c0fc423d4..e6084815d5 100644 --- a/django/contrib/comments/templates/comments/deleted.html +++ b/django/contrib/comments/templates/comments/deleted.html @@ -1,7 +1,8 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Thanks for removing.{% endblock %} +{% block title %}{% trans "Thanks for removing" %}.{% endblock %} {% block content %} - <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> -{% endblock %}
\ No newline at end of file + <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> +{% endblock %} diff --git a/django/contrib/comments/templates/comments/flag.html b/django/contrib/comments/templates/comments/flag.html index 9f694773a2..7a9df5fdef 100644 --- a/django/contrib/comments/templates/comments/flag.html +++ b/django/contrib/comments/templates/comments/flag.html @@ -1,14 +1,15 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Flag this comment{% endblock %} +{% block title %}{% trans "Flag this comment" %}{% endblock %} {% block content %} - <h1>Really flag this comment?</h1> +<h1>{% trans "Really flag this comment?" %}</h1> <blockquote>{{ comment|linebreaks }}</blockquote> <form action="." method="post"> <input type="hidden" name="next" value="{{ next }}" id="next" /> <p class="submit"> - <input type="submit" name="submit" value="Flag" /> or <a href="{{ comment.permalink }}">cancel</a> + <input type="submit" name="submit" value="{% trans "Flag" %}" /> or <a href="{{ comment.permalink }}">cancel</a> </p> </form> {% endblock %} diff --git a/django/contrib/comments/templates/comments/flagged.html b/django/contrib/comments/templates/comments/flagged.html index 7d2dc11572..e558019bff 100644 --- a/django/contrib/comments/templates/comments/flagged.html +++ b/django/contrib/comments/templates/comments/flagged.html @@ -1,7 +1,8 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Thanks for flagging.{% endblock %} +{% block title %}{% trans "Thanks for flagging" %}.{% endblock %} {% block content %} - <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> -{% endblock %}
\ No newline at end of file + <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> +{% endblock %} diff --git a/django/contrib/comments/templates/comments/form.html b/django/contrib/comments/templates/comments/form.html index 183b668c5f..ae0d6952b0 100644 --- a/django/contrib/comments/templates/comments/form.html +++ b/django/contrib/comments/templates/comments/form.html @@ -1,4 +1,4 @@ -{% load comments %} +{% load comments i18n %} <form action="{% comment_form_target %}" method="post"> {% for field in form %} {% if field.is_hidden %} @@ -13,7 +13,7 @@ {% endif %} {% endfor %} <p class="submit"> - <input type="submit" name="submit" class="submit-post" value="Post" /> - <input type="submit" name="submit" class="submit-preview" value="Preview" /> + <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" /> + <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> </p> </form> diff --git a/django/contrib/comments/templates/comments/moderation_queue.html b/django/contrib/comments/templates/comments/moderation_queue.html index 7cb3c62583..73012b3539 100644 --- a/django/contrib/comments/templates/comments/moderation_queue.html +++ b/django/contrib/comments/templates/comments/moderation_queue.html @@ -1,7 +1,7 @@ {% extends "admin/change_list.html" %} -{% load adminmedia %} +{% load adminmedia i18n %} -{% block title %}Comment moderation queue{% endblock %} +{% block title %}{% trans "Comment moderation queue" %}{% endblock %} {% block extrahead %} {{ block.super }} @@ -16,28 +16,28 @@ {% endblock %} {% block branding %} -<h1 id="site-name">Comment moderation queue</h1> +<h1 id="site-name">{% trans "Comment moderation queue" %}</h1> {% endblock %} {% block breadcrumbs %}{% endblock %} {% block content %} {% if empty %} - <p id="nocomments">No comments to moderate.</p> +<p id="nocomments">{% trans "No comments to moderate" %}.</p> {% else %} <div id="content-main"> <div class="module" id="changelist"> <table cellspacing="0"> <thead> <tr> - <th>Action</th> - <th>Name</th> - <th>Comment</th> - <th>Email</th> - <th>URL</th> - <th>Authenticated?</th> - <th>IP Address</th> - <th class="sorted desc">Date posted</th> + <th>{% trans "Action" %}</th> + <th>{% trans "Name" %}</th> + <th>{% trans "Comment" %}</th> + <th>{% trans "Email" %}</th> + <th>{% trans "URL" %}</th> + <th>{% trans "Authenticated?" %}</th> + <th>{% trans "IP Address" %}</th> + <th class="sorted desc">{% trans "Date posted" %}</th> </tr> </thead> <tbody> @@ -46,11 +46,11 @@ <td class="actions"> <form action="{% url comments-approve comment.pk %}" method="post"> <input type="hidden" name="next" value="{% url comments-moderation-queue %}" /> - <input class="approve submit" type="submit" name="submit" value="Approve" /> + <input class="approve submit" type="submit" name="submit" value="{% trans "Approve" %}" /> </form> <form action="{% url comments-delete comment.pk %}" method="post"> <input type="hidden" name="next" value="{% url comments-moderation-queue %}" /> - <input class="remove submit" type="submit" name="submit" value="Remove" /> + <input class="remove submit" type="submit" name="submit" value="{% trans "Remove" %}" /> </form> </td> <td>{{ comment.name }}</td> @@ -60,7 +60,7 @@ <td> <img src="{% admin_media_prefix %}img/admin/icon-{% if comment.user %}yes{% else %}no{% endif %}.gif" - alt="{% if comment.user %}yes{% else %}no{% endif %}" + alt="{% if comment.user %}{% trans "yes" %}{% else %}{% trans "no" %}{% endif %}" /> </td> <td>{{ comment.ip_address }}</td> diff --git a/django/contrib/comments/templates/comments/posted.html b/django/contrib/comments/templates/comments/posted.html index 2833c11c48..76f7f6d586 100644 --- a/django/contrib/comments/templates/comments/posted.html +++ b/django/contrib/comments/templates/comments/posted.html @@ -1,7 +1,8 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Thanks for commenting.{% endblock %} +{% block title %}{% trans "Thanks for commenting" %}.{% endblock %} {% block content %} - <h1>Thank you for your comment.</h1> -{% endblock %}
\ No newline at end of file + <h1>{% trans "Thank you for your comment" %}.</h1> +{% endblock %} diff --git a/django/contrib/comments/templates/comments/preview.html b/django/contrib/comments/templates/comments/preview.html index 273e373583..dc4326b542 100644 --- a/django/contrib/comments/templates/comments/preview.html +++ b/django/contrib/comments/templates/comments/preview.html @@ -1,17 +1,18 @@ {% extends "comments/base.html" %} +{% load i18n %} -{% block title %}Preview your comment{% endblock %} +{% block title %}{% trans "Preview your comment" %}{% endblock %} {% block content %} {% load comments %} <form action="{% comment_form_target %}" method="post"> {% if form.errors %} - <h1>Please correct the error{{ form.errors|pluralize }} below</h1> + <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1> {% else %} - <h1>Preview your comment</h1> + <h1>{% trans "Preview your comment" %}</h1> <blockquote>{{ comment|linebreaks }}</blockquote> <p> - and <input type="submit" name="submit" value="Post your comment" id="submit" /> or make changes: + {% trans "and" %} <input type="submit" name="submit" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}: </p> {% endif %} {% for field in form %} @@ -27,8 +28,8 @@ {% endif %} {% endfor %} <p class="submit"> - <input type="submit" name="submit" class="submit-post" value="Post" /> - <input type="submit" name="submit" class="submit-preview" value="Preview" /> + <input type="submit" name="submit" class="submit-post" value="{% trans "Post" %}" /> + <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> </p> </form> {% endblock %} diff --git a/django/contrib/comments/views/comments.py b/django/contrib/comments/views/comments.py index 264d5a8b13..10107890fa 100644 --- a/django/contrib/comments/views/comments.py +++ b/django/contrib/comments/views/comments.py @@ -62,8 +62,7 @@ def post_comment(request, next=None): (escape(ctype), escape(object_pk))) # Do we want to preview the comment? - preview = data.get("submit", "").lower() == "preview" or \ - data.get("preview", None) is not None + preview = "preview" in data # Construct the comment form form = comments.get_form()(target, data=data) @@ -85,7 +84,7 @@ def post_comment(request, next=None): template_list, { "comment" : form.data.get("comment", ""), "form" : form, - }, + }, RequestContext(request, {}) ) diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py index f82a5e17d8..0c975116ef 100644 --- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py +++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py @@ -45,7 +45,7 @@ class CommentViewTests(CommentTestCase): def testCommentPreview(self): a = Article.objects.get(pk=1) data = self.getValidData(a) - data["submit"] = "preview" + data["preview"] = "Preview" response = self.client.post("/post/", data) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, "comments/preview.html") |
