Django

Code

Changeset 9119

Show
Ignore:
Timestamp:
10/05/08 00:09:21 (3 months ago)
Author:
mtredinnick
Message:

Add internationalisation support to the comment templates. Fixed #8868, #8905

Thanks to zgoda for a patch that did most of the internationalisation part.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/comments/templates/comments/approved.html

    r8557 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Thanks for approving.{% endblock %} 
     4{% block title %}{% trans "Thanks for approving" %}.{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> 
     7  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> 
    78{% endblock %} 
  • django/trunk/django/contrib/comments/templates/comments/approve.html

    r9117 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Approve a comment{% endblock %} 
     4{% block title %}{% trans "Approve a comment" %}{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Really make this comment public?</h1> 
     7  <h1>{% trans "Really make this comment public?" %}</h1> 
    78  <blockquote>{{ comment|linebreaks }}</blockquote> 
    89  <form action="." method="post"> 
    910    <input type="hidden" name="next" value="{{ next }}" id="next" /> 
    1011    <p class="submit"> 
    11       <input type="submit" name="submit" value="Approve" /> or <a href="{{ comment.permalink }}">cancel</a> 
     12      <input type="submit" name="submit" value="{% trans "Approve" %}" /> or <a href="{{ comment.permalink }}">cancel</a> 
    1213    </p> 
    1314  </form> 
  • django/trunk/django/contrib/comments/templates/comments/deleted.html

    r8557 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Thanks for removing.{% endblock %} 
     4{% block title %}{% trans "Thanks for removing" %}.{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> 
     7  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> 
    78{% endblock %} 
  • django/trunk/django/contrib/comments/templates/comments/delete.html

    r9117 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Remove a comment{% endblock %} 
     4{% block title %}{% trans "Remove a comment" %}{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Really remove this comment?</h1> 
     7<h1>{% trans "Really remove this comment?" %}</h1> 
    78  <blockquote>{{ comment|linebreaks }}</blockquote> 
    89  <form action="." method="post"> 
    910    <input type="hidden" name="next" value="{{ next }}" id="next" /> 
    1011    <p class="submit"> 
    11       <input type="submit" name="submit" value="Remove" /> or <a href="{{ comment.permalink }}">cancel</a> 
     12    <input type="submit" name="submit" value="{% trans "Remove" %}" /> or <a href="{{ comment.permalink }}">cancel</a> 
    1213    </p> 
    1314  </form> 
  • django/trunk/django/contrib/comments/templates/comments/flagged.html

    r8557 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Thanks for flagging.{% endblock %} 
     4{% block title %}{% trans "Thanks for flagging" %}.{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Thanks for taking the time to improve the quality of discussion on our site.</h1> 
     7  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1> 
    78{% endblock %} 
  • django/trunk/django/contrib/comments/templates/comments/flag.html

    r9117 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Flag this comment{% endblock %} 
     4{% block title %}{% trans "Flag this comment" %}{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Really flag this comment?</h1> 
     7<h1>{% trans "Really flag this comment?" %}</h1> 
    78  <blockquote>{{ comment|linebreaks }}</blockquote> 
    89  <form action="." method="post"> 
    910    <input type="hidden" name="next" value="{{ next }}" id="next" /> 
    1011    <p class="submit"> 
    11       <input type="submit" name="submit" value="Flag" /> or <a href="{{ comment.permalink }}">cancel</a> 
     12    <input type="submit" name="submit" value="{% trans "Flag" %}" /> or <a href="{{ comment.permalink }}">cancel</a> 
    1213    </p> 
    1314  </form> 
  • django/trunk/django/contrib/comments/templates/comments/form.html

    r9050 r9119  
    1 {% load comments %} 
     1{% load comments i18n %} 
    22<form action="{% comment_form_target %}" method="post"> 
    33  {% for field in form %} 
     
    1414  {% endfor %} 
    1515  <p class="submit"> 
    16     <input type="submit" name="submit" class="submit-post" value="Post" /> 
    17     <input type="submit" name="submit" class="submit-preview" value="Preview" /> 
     16    <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" /> 
     17    <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> 
    1818  </p> 
    1919</form> 
  • django/trunk/django/contrib/comments/templates/comments/moderation_queue.html

    r9117 r9119  
    11{% extends "admin/change_list.html" %} 
    2 {% load adminmedia %} 
     2{% load adminmedia i18n %} 
    33 
    4 {% block title %}Comment moderation queue{% endblock %} 
     4{% block title %}{% trans "Comment moderation queue" %}{% endblock %} 
    55 
    66{% block extrahead %} 
     
    1717 
    1818{% block branding %} 
    19 <h1 id="site-name">Comment moderation queue</h1> 
     19<h1 id="site-name">{% trans "Comment moderation queue" %}</h1> 
    2020{% endblock %} 
    2121 
     
    2424{% block content %} 
    2525{% if empty %} 
    26   <p id="nocomments">No comments to moderate.</p> 
     26<p id="nocomments">{% trans "No comments to moderate" %}.</p> 
    2727{% else %} 
    2828<div id="content-main"> 
     
    3131      <thead> 
    3232        <tr> 
    33           <th>Action</th> 
    34           <th>Name</th> 
    35           <th>Comment</th> 
    36           <th>Email</th> 
    37           <th>URL</th> 
    38           <th>Authenticated?</th> 
    39           <th>IP Address</th> 
    40           <th class="sorted desc">Date posted</th> 
     33          <th>{% trans "Action" %}</th> 
     34          <th>{% trans "Name" %}</th> 
     35          <th>{% trans "Comment" %}</th> 
     36          <th>{% trans "Email" %}</th> 
     37          <th>{% trans "URL" %}</th> 
     38          <th>{% trans "Authenticated?" %}</th> 
     39          <th>{% trans "IP Address" %}</th> 
     40          <th class="sorted desc">{% trans "Date posted" %}</th> 
    4141        </tr> 
    4242    </thead> 
     
    4747            <form action="{% url comments-approve comment.pk %}" method="post"> 
    4848              <input type="hidden" name="next" value="{% url comments-moderation-queue %}" /> 
    49               <input class="approve submit" type="submit" name="submit" value="Approve" /> 
     49              <input class="approve submit" type="submit" name="submit" value="{% trans "Approve" %}" /> 
    5050            </form> 
    5151            <form action="{% url comments-delete comment.pk %}" method="post"> 
    5252              <input type="hidden" name="next" value="{% url comments-moderation-queue %}" /> 
    53               <input class="remove submit" type="submit" name="submit" value="Remove" /> 
     53              <input class="remove submit" type="submit" name="submit" value="{% trans "Remove" %}" /> 
    5454            </form> 
    5555          </td> 
     
    6161            <img 
    6262              src="{% admin_media_prefix %}img/admin/icon-{% if comment.user %}yes{% else %}no{% endif %}.gif" 
    63               alt="{% if comment.user %}yes{% else %}no{% endif %}" 
     63              alt="{% if comment.user %}{% trans "yes" %}{% else %}{% trans "no" %}{% endif %}" 
    6464            /> 
    6565          </td> 
  • django/trunk/django/contrib/comments/templates/comments/posted.html

    r8557 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Thanks for commenting.{% endblock %} 
     4{% block title %}{% trans "Thanks for commenting" %}.{% endblock %} 
    45 
    56{% block content %} 
    6   <h1>Thank you for your comment.</h1> 
     7  <h1>{% trans "Thank you for your comment" %}.</h1> 
    78{% endblock %} 
  • django/trunk/django/contrib/comments/templates/comments/preview.html

    r9117 r9119  
    11{% extends "comments/base.html" %} 
     2{% load i18n %} 
    23 
    3 {% block title %}Preview your comment{% endblock %} 
     4{% block title %}{% trans "Preview your comment" %}{% endblock %} 
    45 
    56{% block content %} 
     
    78  <form action="{% comment_form_target %}" method="post"> 
    89    {% if form.errors %} 
    9       <h1>Please correct the error{{ form.errors|pluralize }} below</h1> 
     10    <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1> 
    1011    {% else %} 
    11       <h1>Preview your comment</h1> 
     12    <h1>{% trans "Preview your comment" %}</h1> 
    1213      <blockquote>{{ comment|linebreaks }}</blockquote> 
    1314      <p> 
    14         and <input type="submit" name="submit" value="Post your comment" id="submit" /> or make changes
     15      {% trans "and" %} <input type="submit" name="submit" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}
    1516      </p> 
    1617    {% endif %} 
     
    2829    {% endfor %} 
    2930    <p class="submit"> 
    30       <input type="submit" name="submit" class="submit-post" value="Post" /> 
    31       <input type="submit" name="submit" class="submit-preview" value="Preview" /> 
     31    <input type="submit" name="submit" class="submit-post" value="{% trans "Post" %}" /> 
     32    <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> 
    3233    </p> 
    3334  </form> 
  • django/trunk/django/contrib/comments/views/comments.py

    r9118 r9119  
    6363 
    6464    # Do we want to preview the comment? 
    65     preview = data.get("submit", "").lower() == "preview" or \ 
    66               data.get("preview", None) is not None 
     65    preview = "preview" in data 
    6766 
    6867    # Construct the comment form 
     
    8685                "comment" : form.data.get("comment", ""), 
    8786                "form" : form, 
    88             },  
     87            }, 
    8988            RequestContext(request, {}) 
    9089        ) 
  • django/trunk/tests/regressiontests/comment_tests/tests/comment_view_tests.py

    r9118 r9119  
    4646        a = Article.objects.get(pk=1) 
    4747        data = self.getValidData(a) 
    48         data["submit"] = "preview" 
     48        data["preview"] = "Preview" 
    4949        response = self.client.post("/post/", data) 
    5050        self.assertEqual(response.status_code, 200)