Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions cms/djangoapps/contentstore/views/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from .access import get_location_and_verify_access
from util.json_request import JsonResponse

from django.utils.translation import ugettext as _

__all__ = ['asset_index', 'upload_asset', 'import_course',
'generate_export_course', 'export_course']
Expand Down
26 changes: 12 additions & 14 deletions cms/static/client_templates/course_grade_policy.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
<li class="field-group course-grading-assignment-list-item">
<div class="field text" id="field-course-grading-assignment-name">
<label for="course-grading-assignment-name">Assignment Type Name</label>
<input type="text" class="long" id="course-grading-assignment-name" value="<%= model.get('type') %>" />
<span class="tip tip-stacked">e.g. Homework, Midterm Exams</span>
<label for="course-grading-assignment-name"><%= gettext("Assignment Type Name") %></label>
<input type="text" class="long" id="course-grading-assignment-name" value="<%= model.get('type') %>" />
<span class="tip tip-stacked"><%= gettext("e.g. Homework, Midterm Exams") %></span>
</div>

<div class="field text" id="field-course-grading-assignment-shortname">
<label for="course-grading-assignment-shortname">Abbreviation:</label>
<label for="course-grading-assignment-shortname"><%= gettext("Abbreviation:") %></label>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

django.utils.translation.ugettext should be imported as _ and used here, so that the translation extraction code will pick up these strings to extract.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This HTML seems to be inserted directly. Import statement may course some problems...
We copied these strings to another js file to let them be picked.

<input type="text" class="short" id="course-grading-assignment-shortname" value="<%= model.get('short_label') %>" />
<span class="tip tip-inline">e.g. HW, Midterm</span>
<span class="tip tip-inline"><%= gettext("e.g. HW, Midterm") %></span>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While we're here, can we drop the elite "e.g." in favor of "for example" ?

</div>

<div class="field text" id="field-course-grading-assignment-gradeweight">
<label for="course-grading-assignment-gradeweight">Weight of Total Grade</label>
<label for="course-grading-assignment-gradeweight"><%= gettext("Weight of Total Grade") %></label>
<input type="text" class="short" id="course-grading-assignment-gradeweight" value = "<%= model.get('weight') %>" />
<span class="tip tip-inline">e.g. 25%</span>
<span class="tip tip-inline"><%= gettext("e.g. 25%") %></span>
</div>

<div class="field text" id="field-course-grading-assignment-totalassignments">
<label for="course-grading-assignment-totalassignments">Total
Number</label>
<label for="course-grading-assignment-totalassignments"><%= gettext("Total Number") %></label>
<input type="text" class="short" id="course-grading-assignment-totalassignments" value = "<%= model.get('min_count') %>" />
<span class="tip tip-inline">total exercises assigned</span>
<span class="tip tip-inline"><%= gettext("total exercises assigned") %></span>
</div>

<div class="field text" id="field-course-grading-assignment-droppable">
<label for="course-grading-assignment-droppable">Number of
Droppable</label>
<label for="course-grading-assignment-droppable"><%= gettext("Number of Droppable") %></label>
<input type="text" class="short" id="course-grading-assignment-droppable" value = "<%= model.get('drop_count') %>" />
<span class="tip tip-inline">total exercises that won't be graded</span>
<span class="tip tip-inline"><%= gettext("total exercises that won't be graded") %></span>
</div>

<div class="actions">
<a href="#" class="button delete-button standard remove-item remove-grading-data"><span class="delete-icon"></span>Delete</a>
<a href="#" class="button delete-button standard remove-item remove-grading-data"><span class="delete-icon"></span><%= gettext("Delete") %></a>
</div>
</li>
12 changes: 6 additions & 6 deletions cms/templates/asset_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<div class="wrapper-mast wrapper">
<header class="mast has-actions has-subtitle">
<h1 class="page-header">
<small class="subtitle">Content</small>
<span class="sr">&gt; </span>Files &amp; Uploads
<small class="subtitle">${_("Content")}</small>
<span class="sr">&gt; </span>${_("Files &amp; Uploads")}
</h1>

<nav class="nav-actions">
Expand All @@ -65,9 +65,9 @@ <h3 class="sr">Page Actions</h3>
<thead>
<tr>
<th class="thumb-col"></th>
<th class="name-col">Name</th>
<th class="date-col">Date Added</th>
<th class="embed-col">URL</th>
<th class="name-col">${_("Name")}</th>
<th class="date-col">${_("Date Added")}</th>
<th class="embed-col">${_("URL")}</th>
<th class="delete-col"></th>
</tr>
</thead>
Expand Down Expand Up @@ -116,7 +116,7 @@ <h3 class="sr">Page Actions</h3>
<div class="upload-modal modal">
<a href="#" class="close-button"><span class="close-icon"></span></a>
<div class="modal-body">
<h1>Upload New File</h1>
<h1>${_("Upload New File")}</h1>
<p class="file-name"></a>
<div class="progress-bar">
<div class="progress-fill"></div>
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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
7 changes: 4 additions & 3 deletions cms/templates/widgets/units.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%! from django.core.urlresolvers import reverse %>
<%! from contentstore.utils import compute_unit_state %>
<%! from django.utils.translation import ugettext as _ %>

<!--
This def will enumerate through a passed in subsection and list all of the units
Expand All @@ -26,16 +27,16 @@
</a>
% if actions:
<div class="item-actions">
<a href="#" data-tooltip="Delete this unit" class="delete-button" data-id="${unit.location}"><span class="delete-icon"></span></a>
<a href="#" data-tooltip="Drag to sort" class="drag-handle"></a>
<a href="#" data-tooltip='${_("Delete this unit")}' class="delete-button" data-id="${unit.location}"><span class="delete-icon"></span></a>
<a href="#" data-tooltip='${_("Drag to sort")}' class="drag-handle"></a>
</div>
% endif
</div>
</li>
% endfor
<li>
<a href="#" class="new-unit-item" data-category="${new_unit_category}" data-parent="${subsection.location}">
<span class="new-unit-icon"></span>New Unit
<span class="new-unit-icon"></span>${_("New Unit")}
</a>
</li>
</ol>
Expand Down
12 changes: 6 additions & 6 deletions common/djangoapps/student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,12 @@ def create_account(request, post_override=None):

for a in required_post_vars:
if len(post_vars[a]) < 2:
error_str = {'username': 'Username must be minimum of two characters long.',
'email': 'A properly formatted e-mail is required.',
'name': 'Your legal name must be a minimum of two characters long.',
'password': 'A valid password is required.',
'terms_of_service': 'Accepting Terms of Service is required.',
'honor_code': 'Agreeing to the Honor Code is required.'}
error_str = {'username': _('Username must be minimum of two characters long.'),
'email': _('A properly formatted e-mail is required.'),
'name': _('Your legal name must be a minimum of two characters long.'),
'password': _('A valid password is required.'),
'terms_of_service': _('Accepting Terms of Service is required.'),
'honor_code': _('Agreeing to the Honor Code is required.')}
js['value'] = error_str[a]
js['field'] = a
return HttpResponse(json.dumps(js))
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ <h2>${_('Are you sure you want to unregister from {course_number}?').format(cour
<input name="course_id" id="unenroll_course_id" type="hidden" />
<input name="enrollment_action" type="hidden" value="unenroll" />
<div class="submit">
<input name="submit" type="submit" value="Unregister" />
<input name="submit" type="submit" value=${_("Unregister")} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't believe that submit action values should be translated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

They are shown on the button, though. I think the only way to send a different value than the text on the button is to use <button> rather than <input>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actual input is here: type="hidden" value="unenroll"
There is also a same problem which value is "enroll" in course registration page.
button is a good idea

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should ${_("Unregister")} be put in quotations?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, it'll break the HTML without the outer quotes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dfnjy , can you put the value in quotations?

</div>
</form>

Expand Down
15 changes: 4 additions & 11 deletions lms/templates/emails/activation_email.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<%! from django.utils.translation import ugettext as _ %>
<%namespace file="../main.html" import="stanford_theme_enabled" />

Thank you for signing up for ${settings.PLATFORM_NAME}! To activate
your account, please copy and paste this address into your web
browser's address bar:
${_("Thank you for signing up for {0}! To activate your account, please copy and paste this address into your web browser's address bar:").format(settings.PLATFORM_NAME)}

% if is_secure:
https://${ site }/activate/${ key }
Expand All @@ -12,13 +11,7 @@ browser's address bar:

## Temporary hack until we develop a better way to adjust language
% if stanford_theme_enabled():
If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail;
if you require assistance, check the about section of the
${settings.PLATFORM_NAME} Courses web site.
${_("If you didn't request this, you don't need to do anything; you won't receive any more email from us. Please do not reply to this e-mail; if you require assistance, check the about section of the {0} Courses web site.").format(settings.PLATFORM_NAME)}
% else:
If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail;
if you require assistance, check the help section of the
${settings.PLATFORM_NAME} web site.
${_("If you didn't request this, you don't need to do anything; you won't receive any more email from us. Please do not reply to this e-mail; if you require assistance, check the help section of the {0} web site.").format(settings.PLATFORM_NAME)}
% endif
3 changes: 2 additions & 1 deletion lms/templates/emails/activation_email_subject.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Your account for ${settings.PLATFORM_NAME}
<%! from django.utils.translation import ugettext as _ %>
${_("Your account for {0}").format(settings.PLATFORM_NAME)}
16 changes: 4 additions & 12 deletions lms/templates/emails/email_change.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<%! from django.utils.translation import ugettext as _ %>
<%namespace file="../main.html" import="stanford_theme_enabled" />
We received a request to change the e-mail associated with your
${settings.PLATFORM_NAME} account from ${old_email} to ${new_email}.
If this is correct, please confirm your new e-mail address by
visiting:
${_("We received a request to change the e-mail associated with your {plat} account from {old} to {new}. If this is correct, please confirm your new e-mail address by visiting:").format(plat=settings.PLATFORM_NAME,old=old_email,new=new_email)}

% if is_secure:
https://${ site }/email_confirm/${ key }
Expand All @@ -12,13 +10,7 @@ visiting:

## TODO: fix this ugly hack
% if stanford_theme_enabled():
If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail;
if you require assistance, check the about section of the
${settings.PLATFORM_NAME} Courses web site.
${_("If you didn\'t request this, you don\'t need to do anything; you won\'t receive any more email from us. Please do not reply to this e-mail; if you require assistance, check the about section of the {0} Courses web site.").format(settings.PLATFORM_NAME)}
% else:
If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail;
if you require assistance, check the help section of the
${settings.PLATFORM_NAME} web site.
${_("If you didn\'t request this, you don\'t need to do anything; you won\'t receive any more email from us. Please do not reply to this e-mail; if you require assistance, check the help section of the {0} web site.").format(settings.PLATFORM_NAME)}
% endif
3 changes: 2 additions & 1 deletion lms/templates/emails/email_change_subject.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Request to change ${settings.PLATFORM_NAME} account e-mail
<%! from django.utils.translation import ugettext as _ %>
${_('Request to change {0} account e-mail').format(settings.PLATFORM_NAME)}
2 changes: 1 addition & 1 deletion lms/templates/forgot_password_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2>${_("Password Reset")}</h2>
<ol class="list-input">
<li class="field required text" id="field-email">
<label for="pwd_reset_email">${_("Your E-mail Address")}</label>
<input class="" id="pwd_reset_email" type="email" name="email" value="" placeholder="example: username@domain.com" />
<input class="" id="pwd_reset_email" type="email" name="email" value="" placeholder='${_("example: username@domain.com")}' />
<span class="tip tip-input">${_("This is the email address you used to register with {platform}").format(platform=settings.PLATFORM_NAME)}</span>
</li>
</ol>
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h3 class="message-title">${_("The following errors occured while logging you in
<ol class="list-input">
<li class="field required text" id="field-email">
<label for="email">${_('E-mail')}</label>
<input class="" id="email" type="email" name="email" value="" placeholder="example: username@domain.com" required aria-required="true" />
<input class="" id="email" type="email" name="email" value="" placeholder='${_("example: username@domain.com")}' required aria-required="true" />
</li>
<li class="field required password" id="field-password">
<label for="password">${_('Password')}</label>
Expand Down
6 changes: 5 additions & 1 deletion lms/templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<<<<<<< HEAD
=======
{% load i18n %}
>>>>>>> master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a merge conflict!

{% load compressed %}
{% load i18n %}
{% load staticfiles %}
<!DOCTYPE html>
<html>
Expand Down Expand Up @@ -151,4 +155,4 @@ <h3>{% trans "Need Help?" %}</h3>
</div>
</aside>
</section>
</section>
</section>