diff --git a/scanblog/TODO b/scanblog/TODO index 8345043..fe4f67c 100644 --- a/scanblog/TODO +++ b/scanblog/TODO @@ -2,4 +2,12 @@ * replace ✍ by css class and css display -* optionnal sharing buttons +* optional sharing buttons + +* Replace atomic translations with blocktrans in the following: + - scanblog/templates/blogs/_sharing_buttons.html + - scanblog/templates/blogs/all_comments_list.html + - scanblog/templates/blogs/delete_post.html + - scanblog/templates/blogs/tag_post_list.html + - scanblog/templates/btb/admin-content-flagged.txt + - scanblog/templates/comments/unremove_comment.html diff --git a/scanblog/templates/about/terms.html b/scanblog/templates/about/terms.html index a4ea1bf..f71ee82 100644 --- a/scanblog/templates/about/terms.html +++ b/scanblog/templates/about/terms.html @@ -4,7 +4,11 @@ {% block title %}{% trans "Terms of Use" %}{% endblock %} {% block body %}
-

{% trans "{{ site.name }} Terms of Use" %}

+

+ {% blocktrans with site_name=site.name %} + Terms of Use + {% endblocktrans %} +

{% blocktrans %} PLEASE REVIEW BEFORE USING THIS WEBSITE – IF YOU DO NOT AGREE TO THESE TERMS OF USE, DO NOT USE THIS WEBSITE. diff --git a/scanblog/templates/blogs/page_picker.html b/scanblog/templates/blogs/page_picker.html index c226540..621a7a6 100644 --- a/scanblog/templates/blogs/page_picker.html +++ b/scanblog/templates/blogs/page_picker.html @@ -40,7 +40,10 @@ }

{% trans "Every page" %}

diff --git a/scanblog/templates/blogs/post_detail.html b/scanblog/templates/blogs/post_detail.html index abf6998..393115b 100644 --- a/scanblog/templates/blogs/post_detail.html +++ b/scanblog/templates/blogs/post_detail.html @@ -7,7 +7,8 @@ {% load favorites %} -{% block title %}{% firstof post.title "Untitled" %} — {{post.author.profile}}{% endblock %} +{% trans "Untitled" as untitled_i18n %} +{% block title %}{% firstof post.title untitled_i18n %} — {{post.author.profile}}{% endblock %} {% block head %} {% with feed_author=post.author comment_feed_obj=post %} @@ -33,7 +34,8 @@ {% endif %} {% trans "by" %} {{ post.author.profile.display_name }} {% if post.author.profile.has_public_profile %} - ({% trans "author's profile" %}) + {% blocktrans with profile_url=post.author.profile.get_absolute_url %} + (author's profile) {% endif %} {% if org.public %}, {% trans "writing for" %} {{ org.name }}{% endif %} {% if org.public %}{{ org.footer|safe }}{% endif %} diff --git a/scanblog/templates/btb/org_status_email.html b/scanblog/templates/btb/org_status_email.html index 6a9c752..fa0a6d1 100644 --- a/scanblog/templates/btb/org_status_email.html +++ b/scanblog/templates/btb/org_status_email.html @@ -28,7 +28,11 @@ -

{% trans "The State of the {{ org.name }} is" %} {{ adjective.word }}

+

+ {% blocktrans with org_name=org.name adjective_word=adjective.word %} + The State of the {{ org_name }} is {{ adjective_word }} + {% endblocktrans %} +

{{ adjective.word }}: {{ adjective.definition }}

{% trans "Distance from inbox zero:" %} {{ inbox_zero_distance }}.

{% if inbox_zero_distance == 0 %} diff --git a/scanblog/templates/comments/_comment.html b/scanblog/templates/comments/_comment.html index 1d3ff5b..b913d75 100644 --- a/scanblog/templates/comments/_comment.html +++ b/scanblog/templates/comments/_comment.html @@ -14,12 +14,15 @@ - {% trans "Posted {{ comment.created|timesince }} ago." %} + {% blocktrans with time_since_created=comment.created|timesince %} + Posted {{ time_since_created }} ago. + {% endblocktrans %} {% if comment.letter_sent and not comment.removed %} ✓ - {% trans "Mailed {{ comment.letter_sent|timesince }} ago" %} + {% blocktrans with time_since_sent=comment.letter_sent|timesince %} + Mailed {{ time_since_sent }} ago {% endif %} diff --git a/scanblog/templates/comments/remove_comment.html b/scanblog/templates/comments/remove_comment.html index 83010ae..cbe81d1 100644 --- a/scanblog/templates/comments/remove_comment.html +++ b/scanblog/templates/comments/remove_comment.html @@ -36,11 +36,15 @@

{% trans "Remove Comment" %}

{% if removal.pk %}

- {% trans "This comment has been removed." %} {% trans "You can edit the messages that haven't been sent below. - Changed your mind?" %} {% trans "Restore (unremove) this comment" %}. + {% trans "This comment has been removed." %} + {% trans "You can edit the messages that haven't been sent below. Changed your mind?" %} {% trans "Restore (unremove) this comment" %}.

{% else %} -

{% trans "Remove the following comment by {{ comment.user.profile }}? (If this is spam, use this form instead)" %}

+

+ {% url "comments.spam_can_comment" comment.pk as spam_comment_url %} + {% blocktrans with commenter=comment.user.profile %} + Remove the following comment by {{ commenter }}? (If this is spam, use this form instead)

+ {% endblocktrans %} {% endif %}

posted {{ comment.created|date }} on @@ -107,8 +111,7 @@

{% firstof form.post_author_message.label "Post author message" %}

{% if form.post_author_message.errors %}

- {% trans "There was an error with the message body below; we couldn't - compile it into a letter." %} + {% trans "There was an error with the message body below; we couldn't compile it into a letter." %}

{% trans "The cryptic error message we got was:" %}

{{ form.post_author_message.errors }}
diff --git a/scanblog/templates/comments/unremove_comment.html b/scanblog/templates/comments/unremove_comment.html index c0ab1f5..caef5c9 100644 --- a/scanblog/templates/comments/unremove_comment.html +++ b/scanblog/templates/comments/unremove_comment.html @@ -7,7 +7,11 @@ {% block body %}

{% trans "Unremove Comment" %}

-

{% trans "Restore the following comment, which was removed on {{ removal.date|date }}?" %}

+

+{% blocktrans with removal_date=removal.date|date %} +Restore the following comment, which was removed on {{ removal_date }}? +{% endblocktrans %} +

posted {{ comment.created|date }} on {{ comment.document.get_title }} by diff --git a/scanblog/templates/lint.py b/scanblog/templates/lint.py index f0199c7..004e011 100644 --- a/scanblog/templates/lint.py +++ b/scanblog/templates/lint.py @@ -3,6 +3,8 @@ for root, dirs, files in os.walk(os.path.abspath(os.path.dirname(__file__))): for fn in files: + if fn.endswith(".swp"): + continue path = os.path.join(root, fn) with open(path) as fh: txt = fh.read() @@ -31,3 +33,9 @@ # Look for tabs if "\t" in txt: print "has tab characters", path + + # Look for blocks and variables inside {% trans "" %} tags + for match in re.finditer(r"""\{\% trans ((.(?!\%\}))*) \%\}""", txt): + if re.search("[\{\}]+", match.group(1)): + print "tags in trans", path + diff --git a/scanblog/templates/notification/notice_settings.html b/scanblog/templates/notification/notice_settings.html index 9bb710b..5220df1 100644 --- a/scanblog/templates/notification/notice_settings.html +++ b/scanblog/templates/notification/notice_settings.html @@ -63,7 +63,9 @@

{% trans "Subscriptions" %}

{% trans "Posts from the" %} {{ sub.campaign.title }} campaign {% endif %} {% if sub.affiliation_id %} - {% trans "Posts from the {{ sub.campaign.title }} campaign" %} + {% blocktrans with campaign_url=sub.campaign.get_absolute_url campaign_title=sub.campaign.title %} + Posts from the {{ campaign_title }} campaign + {% endblocktrans %} {% endif %} diff --git a/scanblog/templates/registration/activation_email.txt b/scanblog/templates/registration/activation_email.txt index f49d0fd..7e88907 100644 --- a/scanblog/templates/registration/activation_email.txt +++ b/scanblog/templates/registration/activation_email.txt @@ -1,17 +1,18 @@ {% load i18n %} -{% trans "Hello" %}, +{% blocktrans with site_name=site.name %} +Hello, -{% trans "Welcome to {{ site.name }}! You've just joined a community of respectful -people who value helping to give a voice to the voiceless." %} +Welcome to {{ site_name }}! You've just joined a community of respectful +people who value helping to give a voice to the voiceless. -{% trans "To complete your registration, follow this link:" %} +To complete your registration, follow this link: {{ base_url }}/accounts/activate/{{ activation_key }}/ -{% trans "This link will expire in {{ expiration_days }} days, so don't delay." %} +This link will expire in {{ expiration_days }} days, so don't delay. -{% trans "See you on {{ site.name }}! "%} +See you on {{ site_name }}! -{% trans "Sincerely" %}, +Sincerely, -{% trans "{{ site.name }} staff" %} +{{ site.name }} staff {{ base_url }} diff --git a/scanblog/templates/scanning/flag.html b/scanblog/templates/scanning/flag.html index 5254f5c..38b2d6e 100644 --- a/scanblog/templates/scanning/flag.html +++ b/scanblog/templates/scanning/flag.html @@ -3,7 +3,11 @@ {% block title %}Flag document{% endblock %} {% block body %}

{% trans "Flag content" %}

-

{% trans "A flag lets moderators now that something is not right about a particular post, profile, or comment. Please help us by flagging any posts that seem to be against our guidelines, or have been improperly edited (for example, pages not rotated correctly)." %} +

+{% url "about.guidelines" as about_guidelines_url %} +{% blocktrans %} +A flag lets moderators now that something is not right about a particular post, profile, or comment. Please help us by flagging any posts that seem to be against our guidelines, or have been improperly edited (for example, pages not rotated correctly). +{% endblocktrans %}

{% csrf_token %}