Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cms/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h3 class="sr">${_("Page Actions")}</h3>
<article class="content-primary" role="main">

<div class="introduction">
<h2 class="title">${_("Welcome, {0}!".format(user.username))}</h2>
<h2 class="title">${_("Welcome, {0}!").format(user.username)}</h2>

%if len(courses) > 0:
<div class="copy">
Expand Down
10 changes: 6 additions & 4 deletions common/djangoapps/django_comment_common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
from xmodule.modulestore.django import modulestore
from xmodule.course_module import CourseDescriptor

FORUM_ROLE_ADMINISTRATOR = 'Administrator'
FORUM_ROLE_MODERATOR = 'Moderator'
FORUM_ROLE_COMMUNITY_TA = 'Community TA'
FORUM_ROLE_STUDENT = 'Student'
from django.utils.translation import ugettext_noop

FORUM_ROLE_ADMINISTRATOR = ugettext_noop('Administrator')
FORUM_ROLE_MODERATOR = ugettext_noop('Moderator')
FORUM_ROLE_COMMUNITY_TA = ugettext_noop('Community TA')
FORUM_ROLE_STUDENT = ugettext_noop('Student')


@receiver(post_save, sender=CourseEnrollment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if Backbone?
else
@newPostForm.show()
@toggleDiscussionBtn.addClass('shown')
@toggleDiscussionBtn.find('.button-text').html("Hide Discussion")
@toggleDiscussionBtn.find('.button-text').html(gettext("Hide Discussion"))
@$("section.discussion").slideDown()
@showed = true

Expand All @@ -39,15 +39,15 @@ if Backbone?
hideDiscussion: ->
@$("section.discussion").slideUp()
@toggleDiscussionBtn.removeClass('shown')
@toggleDiscussionBtn.find('.button-text').html("Show Discussion")
@toggleDiscussionBtn.find('.button-text').html(gettext("Show Discussion"))
@showed = false

toggleDiscussion: (event) ->
if @showed
@hideDiscussion()
else
@toggleDiscussionBtn.addClass('shown')
@toggleDiscussionBtn.find('.button-text').html("Hide Discussion")
@toggleDiscussionBtn.find('.button-text').html(gettext("Hide Discussion"))

if @retrieved
@$("section.discussion").slideDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ if Backbone?

renderMorePages: ->
if @displayedCollection.hasMorePages()
@$(".post-list").append("<li class='more-pages'><a href='#'>Load more</a></li>")
@$(".post-list").append("<li class='more-pages'><a href='#'>" + gettext('Load more')+ "</a></li>")

loadMorePages: (event) ->
if event
event.preventDefault()
@$(".more-pages").html('<div class="loading-animation" tabindex=0><span class="sr" role="alert">Loading more threads</span></div>')
@$(".more-pages").html('<div class="loading-animation" tabindex=0><span class="sr" role="alert">' + gettext("Loading more threads") + '</span></div>')
@$(".more-pages").addClass("loading")
loadingDiv = @$(".more-pages .loading-animation")
DiscussionUtil.makeFocusTrap(loadingDiv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ if Backbone?
@$("[data-role=thread-flag]").addClass("flagged")
@$("[data-role=thread-flag]").removeClass("notflagged")
@$(".discussion-flag-abuse").attr("aria-pressed", "true")
@$(".discussion-flag-abuse .flag-label").html("Misuse Reported")
@$(".discussion-flag-abuse .flag-label").html(gettext("Misuse Reported"))
else
@$("[data-role=thread-flag]").removeClass("flagged")
@$("[data-role=thread-flag]").addClass("notflagged")
@$(".discussion-flag-abuse").attr("aria-pressed", "false")
@$(".discussion-flag-abuse .flag-label").html("Report Misuse")
@$(".discussion-flag-abuse .flag-label").html(gettext("Report Misuse"))

renderPinned: =>
if @model.get("pinned")
@$("[data-role=thread-pin]").addClass("pinned")
@$("[data-role=thread-pin]").removeClass("notpinned")
@$(".discussion-pin .pin-label").html("Pinned")
@$(".discussion-pin .pin-label").html(gettext("Pinned"))
else
@$("[data-role=thread-pin]").removeClass("pinned")
@$("[data-role=thread-pin]").addClass("notpinned")
@$(".discussion-pin .pin-label").html("Pin Thread")
@$(".discussion-pin .pin-label").html(gettext("Pin Thread"))


updateModelDetails: =>
Expand Down Expand Up @@ -137,7 +137,7 @@ if Backbone?
if textStatus == 'success'
@model.set('pinned', true)
error: =>
$('.admin-pin').text("Pinning not currently available")
$('.admin-pin').text(gettext("Pinning not currently available"))

unPin: ->
url = @model.urlFor("unPinThread")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if Backbone?

addReplyLink: () ->
if @model.hasOwnProperty('parent')
name = @model.parent.get('username') ? "anonymous"
name = @model.parent.get('username') ? gettext("anonymous")
html = "<a href='#comment_#{@model.parent.id}'>@#{name}</a>: "
p = @$('.response-body p:first')
p.prepend(html)
Expand All @@ -36,7 +36,7 @@ if Backbone?

markAsStaff: ->
if DiscussionUtil.isStaff(@model.get("user_id"))
@$el.find("a.profile-link").after('<span class="staff-label">staff</span>')
@$el.find("a.profile-link").after('<span class="staff-label">' + gettext('staff') + '</span>')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs context to be properly translatable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion for how to provide that context?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see anything to that effect in the django docs. :-(

else if DiscussionUtil.isTA(@model.get("user_id"))
@$el.find("a.profile-link").after('<span class="community-ta-label">Community&nbsp;&nbsp;TA</span>')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if Backbone?
@delegateEvents()
if window.user.voted(@model)
@$(".vote-btn").addClass("is-cast")
@$(".vote-btn span.sr").html("votes (click to remove your vote)")
@$(".vote-btn span.sr").html(gettext("votes (click to remove your vote)"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and similar ones below) should really include the placeholder for the number of vote in the translation string

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you suggest a way to do that? I don't know how this code works, and it sounds like changing it to include the number of votes in this string will require more understanding.

@renderAttrs()
@renderFlagged()
@$el.find(".posted-details").timeago()
Expand All @@ -40,7 +40,7 @@ if Backbone?
markAsStaff: ->
if DiscussionUtil.isStaff(@model.get("user_id"))
@$el.addClass("staff")
@$el.prepend('<div class="staff-banner">staff</div>')
@$el.prepend('<div class="staff-banner">' + gettext('staff') + '</div>')
else if DiscussionUtil.isTA(@model.get("user_id"))
@$el.addClass("community-ta")
@$el.prepend('<div class="community-ta-banner">Community TA</div>')
Expand All @@ -50,10 +50,10 @@ if Backbone?
@$(".vote-btn").toggleClass("is-cast")
if @$(".vote-btn").hasClass("is-cast")
@vote()
@$(".vote-btn span.sr").html("votes (click to remove your vote)")
@$(".vote-btn span.sr").html(gettext("votes (click to remove your vote)"))
else
@unvote()
@$(".vote-btn span.sr").html("votes (click to vote)")
@$(".vote-btn span.sr").html(gettext("votes (click to vote)"))

vote: ->
url = @model.urlFor("upvote")
Expand Down Expand Up @@ -106,12 +106,12 @@ if Backbone?
@$("[data-role=thread-flag]").addClass("flagged")
@$("[data-role=thread-flag]").removeClass("notflagged")
@$(".discussion-flag-abuse").attr("aria-pressed", "true")
@$(".discussion-flag-abuse .flag-label").html("Misuse Reported")
@$(".discussion-flag-abuse .flag-label").html(gettext("Misuse Reported"))
else
@$("[data-role=thread-flag]").removeClass("flagged")
@$("[data-role=thread-flag]").addClass("notflagged")
@$(".discussion-flag-abuse").attr("aria-pressed", "false")
@$(".discussion-flag-abuse .flag-label").html("Report Misuse")
@$(".discussion-flag-abuse .flag-label").html(gettext("Report Misuse"))

updateModelDetails: =>
@renderFlagged()
Loading