Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3b9bfce
tsinghuax i18n changes
thinxer Jun 27, 2013
77ea94f
Corrected LMS main template
singingwolfboy Jul 9, 2013
ae49ccf
Corrected issues with date_utils.py
singingwolfboy Jul 9, 2013
b1c99fb
Revert xmodule i18n: it can't use Django
singingwolfboy Jul 9, 2013
9af2dd2
Reverted i18n changes to section.js
singingwolfboy Jul 9, 2013
0ee771f
Corrected string formatting
singingwolfboy Jul 9, 2013
34704cb
Corrected string formatting issues
singingwolfboy Jul 9, 2013
27bda76
Fixed incorrect string formatting
singingwolfboy Jul 9, 2013
adaaa92
Improved test assertions
singingwolfboy Jul 9, 2013
e06ee08
Improved tests
singingwolfboy Jul 9, 2013
4424620
whitespace
singingwolfboy Jul 9, 2013
e323815
Django templates and Mako templates are different
singingwolfboy Jul 9, 2013
d52f63a
Don't screw up Mako magic comment
singingwolfboy Jul 9, 2013
c32fea5
Capitalization matters
singingwolfboy Jul 9, 2013
de14761
Apparently Mako wants " instead of '
singingwolfboy Jul 9, 2013
eada11f
Username should not be internationalized
singingwolfboy Jul 10, 2013
f73cba7
Make get_default_time_display handle non-ASCII characters
singingwolfboy Jul 10, 2013
21988c4
Can't use Mako in an Underscore template
singingwolfboy Jul 10, 2013
2b52220
Avoid i18ning HTML
singingwolfboy Jul 10, 2013
0783154
Don't i18n tracking keys
singingwolfboy Jul 10, 2013
6553d18
Prefer named parameters for translation strings
singingwolfboy Jul 10, 2013
e610bb4
Use _.template() for i18n interpolation in JS
singingwolfboy Jul 10, 2013
714acde
Avoid HTML in i18n string
singingwolfboy Jul 10, 2013
5663cf3
Remove HTML from translation string, switch to named params
singingwolfboy Jul 11, 2013
3663a39
Fixed typo
singingwolfboy Jul 11, 2013
7376f3f
Put quotation marks around name of textbook in upload dialog
singingwolfboy Jul 11, 2013
96355df
Pull HTML out of translations
singingwolfboy Jul 11, 2013
c3cedc2
Use named parameters in translation strings
singingwolfboy Jul 11, 2013
88d3035
Remove HTML from translated strings
singingwolfboy Jul 11, 2013
2c37959
Fixing up i18n issues
singingwolfboy Jul 11, 2013
d1f35e9
Studio: revises error message copy for 404 and 500 errors
talbs Jul 11, 2013
bd941bf
Studio: revises error message copy for 404 and 500 errors
talbs Jul 11, 2013
4d748d1
Removed edit_static view
singingwolfboy Jul 11, 2013
6f58545
Removed editable_preview.html
singingwolfboy Jul 11, 2013
3e95303
Removed link from translation string
singingwolfboy Jul 11, 2013
f62565a
Remove double-import
singingwolfboy Jul 11, 2013
36829fa
Remove HTML from translation strings
singingwolfboy Jul 11, 2013
526d144
Fixed syntax error
singingwolfboy Jul 11, 2013
b887825
MITOpenCourseware should not be translated
singingwolfboy Jul 11, 2013
4ae4f6c
"edX" should not be translated
singingwolfboy Jul 11, 2013
aa74c77
"edX Studio" should not be translated
singingwolfboy Jul 11, 2013
9dd63de
i18n: Don't chop up sentences in the middle
singingwolfboy Jul 11, 2013
b872cc0
Added a translator comment
singingwolfboy Jul 11, 2013
d3c0cd5
Added translator comment
singingwolfboy Jul 11, 2013
95ed581
Move HTML out of translated strings
singingwolfboy Jul 11, 2013
d3bbe8a
& -> &
singingwolfboy Jul 11, 2013
4b33347
i18n: clean up LMS dashboard
singingwolfboy Jul 11, 2013
c234223
Named parameters for translators
singingwolfboy Jul 11, 2013
6e5791d
edX should not be translated
singingwolfboy Jul 11, 2013
fadb986
Added translator comment
singingwolfboy Jul 11, 2013
6f2e58e
Prefer named parameters in translation strings
singingwolfboy Jul 11, 2013
07838fe
Remove HTML from translated strings
singingwolfboy Jul 11, 2013
8858211
Don't put HTML in translated strings
singingwolfboy Jul 11, 2013
09e90f1
option value should not be translated; prefer named translation params
singingwolfboy Jul 11, 2013
54a4990
i18n fixes
singingwolfboy Jul 11, 2013
adb1e46
More i18n
singingwolfboy Jul 12, 2013
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
5 changes: 3 additions & 2 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import logging
import re
from xmodule.modulestore.draft import DIRECT_ONLY_CATEGORIES
from django.utils.translation import ugettext as _

log = logging.getLogger(__name__)

# In order to instantiate an open ended tab automatically, need to have this data
OPEN_ENDED_PANEL = {"name": "Open Ended Panel", "type": "open_ended"}
NOTES_PANEL = {"name": "My Notes", "type": "notes"}
OPEN_ENDED_PANEL = {"name": _("Open Ended Panel"), "type": "open_ended"}
NOTES_PANEL = {"name": _("My Notes"), "type": "notes"}
EXTRA_TAB_PANELS = dict([(p['type'], p) for p in [OPEN_ENDED_PANEL, NOTES_PANEL]])


Expand Down
6 changes: 1 addition & 5 deletions cms/djangoapps/contentstore/views/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..utils import get_course_for_item, get_modulestore
from .access import get_location_and_verify_access

__all__ = ['edit_tabs', 'reorder_static_tabs', 'static_pages', 'edit_static']
__all__ = ['edit_tabs', 'reorder_static_tabs', 'static_pages']


def initialize_course_tabs(course):
Expand Down Expand Up @@ -127,7 +127,3 @@ def static_pages(request, org, course, coursename):
return render_to_response('static-pages.html', {
'context_course': course,
})


def edit_static(request, org, course, coursename):
return render_to_response('edit-static-page.html', {})
9 changes: 5 additions & 4 deletions cms/djangoapps/contentstore/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from django_future.csrf import ensure_csrf_cookie
from mitxmako.shortcuts import render_to_response

Expand Down Expand Up @@ -78,7 +79,7 @@ def add_user(request, location):
if not email:
msg = {
'Status': 'Failed',
'ErrMsg': 'Please specify an email address.',
'ErrMsg': _('Please specify an email address.'),
}
return JsonResponse(msg, 400)

Expand All @@ -92,15 +93,15 @@ def add_user(request, location):
if user is None:
msg = {
'Status': 'Failed',
'ErrMsg': "Could not find user by email address '{0}'.".format(email),
'ErrMsg': _("Could not find user by email address '{email}'.").format(email=email),
}
return JsonResponse(msg, 404)

# user exists, but hasn't activated account?!?
if not user.is_active:
msg = {
'Status': 'Failed',
'ErrMsg': 'User {0} has registered but has not yet activated his/her account.'.format(email),
'ErrMsg': _('User {email} has registered but has not yet activated his/her account.').format(email=email),
}
return JsonResponse(msg, 400)

Expand Down Expand Up @@ -129,7 +130,7 @@ def remove_user(request, location):
if user is None:
msg = {
'Status': 'Failed',
'ErrMsg': "Could not find user by email address '{0}'.".format(email),
'ErrMsg': _("Could not find user by email address '{email}'.").format(email=email),
}
return JsonResponse(msg, 404)

Expand Down
10 changes: 5 additions & 5 deletions cms/static/client_templates/checklist.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
class="course-checklist"
<% } %>
id="<%= 'course-checklist' + checklistIndex %>">
<% var widthPercentage = 'width:' + percentChecked + '%;'; %>
<span class="viz viz-checklist-status"><span class="viz value viz-checklist-status-value" style="<%= widthPercentage %>">
<span class="int"><%= percentChecked %></span>% of checklist completed</span></span>
<span class="viz viz-checklist-status"><span class="viz value viz-checklist-status-value" style="width: <%= percentChecked %>%;">
<%= _.template(gettext("{number}% of checklists completed"), {number: '<span class="int">' + percentChecked + '</span>'}, {interpolate: /\{(.+?)\}/g}) %>
</span></span>
<header>
<h3 class="checklist-title title-2 is-selectable" title="Collapse/Expand this Checklist">
<i class="icon-caret-down ui-toggle-expansion"></i>
<%= checklistShortDescription %></h3>
<span class="checklist-status status">
Tasks Completed: <span class="status-count"><%= itemsChecked %></span>/<span class="status-amount"><%= items.length %></span>
<%= gettext("Tasks Completed:") %> <span class="status-count"><%= itemsChecked %></span>/<span class="status-amount"><%= items.length %></span>
<i class="icon-ok"></i>
</span>
</header>
Expand Down Expand Up @@ -47,7 +47,7 @@ <h4 class="task-name title title-3"><%= item['short_description'] %></h4>
<li class="action-item">
<a href="<%= item['action_url'] %>" class="action action-primary"
<% if (item['action_external']) { %>
rel="external" title="This link will open in a new browser window/tab"
rel="external" title="<%= gettext("This link will open in a new browser window/tab") %>"
<% } %>
><%= item['action_text'] %></a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion cms/static/client_templates/course_info_handouts.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2>Course Handouts</h2>
<%= model.get('data') %>
</div>
<% } else {%>
<p>You have no handouts defined</p>
<p>${_("You have no handouts defined")}</p>
<% } %>
<form class="edit-handouts-form" style="display: block;">
<div class="row">
Expand Down
1 change: 1 addition & 0 deletions cms/static/coffee/files.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"static_files": [
"../jsi18n/",
"js/vendor/RequireJS.js",
"js/vendor/jquery.min.js",
"js/vendor/jquery-ui.min.js",
Expand Down
38 changes: 19 additions & 19 deletions cms/static/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ $(document).ready(function() {
});

// general link management - new window/tab
$('a[rel="external"]').attr('title', 'This link will open in a new browser window/tab').bind('click', linkNewWindow);
$('a[rel="external"]').attr('title', gettext('This link will open in a new browser window/tab')).bind('click', linkNewWindow);

// general link management - lean modal window
$('a[rel="modal"]').attr('title', 'This link will open in a modal window').leanModal({
$('a[rel="modal"]').attr('title', gettext('This link will open in a modal window')).leanModal({
overlay: 0.50,
closeButton: '.action-modal-close'
});
Expand Down Expand Up @@ -199,8 +199,10 @@ function toggleSections(e) {
$section = $('.courseware-section');
sectionCount = $section.length;
$button = $(this);
$labelCollapsed = $('<i class="icon-arrow-up"></i> <span class="label">Collapse All Sections</span>');
$labelExpanded = $('<i class="icon-arrow-down"></i> <span class="label">Expand All Sections</span>');
$labelCollapsed = $('<i class="icon-arrow-up"></i> <span class="label">' +
gettext('Collapse All Sections') + '</span>');
$labelExpanded = $('<i class="icon-arrow-down"></i> <span class="label">' +
gettext('Expand All Sections') + '</span>');

var buttonLabel = $button.hasClass('is-activated') ? $labelCollapsed : $labelExpanded;
$button.toggleClass('is-activated').html(buttonLabel);
Expand Down Expand Up @@ -326,7 +328,7 @@ function saveSubsection() {
$changedInput = null;
},
error: function() {
showToastMessage('There has been an error while saving your changes.');
showToastMessage(gettext('There has been an error while saving your changes.'));
}
});
}
Expand Down Expand Up @@ -372,7 +374,7 @@ function deleteSection(e) {
}

function _deleteItem($el) {
if (!confirm('Are you sure you wish to delete this item. It cannot be reversed!')) return;
if (!confirm(gettext('Are you sure you wish to delete this item. It cannot be reversed!'))) return;

var id = $el.data('id');

Expand Down Expand Up @@ -599,7 +601,7 @@ function saveNewCourse(e) {
var display_name = $newCourse.find('.new-course-name').val();

if (org == '' || number == '' || display_name == '') {
alert('You must specify all fields in order to create a new course.');
alert(gettext('You must specify all fields in order to create a new course.'));
return;
}

Expand Down Expand Up @@ -726,18 +728,16 @@ function saveSetSectionScheduleDate(e) {
})
}).success(function() {
var $thisSection = $('.courseware-section[data-id="' + id + '"]');
var format = gettext('<strong>Will Release:</strong> %(date)s at %(time)s UTC');
var willReleaseAt = interpolate(format, {
'date': input_date,
'time': input_time
},
true);
$thisSection.find('.section-published-date').html(
'<span class="published-status">' + willReleaseAt + '</span>' +
'<a href="#" class="edit-button" ' +
'" data-date="' + input_date +
'" data-time="' + input_time +
'" data-id="' + id + '">' + gettext('Edit') + '</a>');
var html = _.template(
'<span class="published-status">' +
'<strong>' + gettext("Will Release:") + '</strong>' +
gettext("<%= date %> at <%= time %> UTC") +
'</span>' +
'<a href="#" class="edit-button" data-date="<%= date %>" data-time="<%= time %>" data-id="<%= id %>">' +
gettext("Edit") +
'</a>',
{date: input_date, time: input_time, id: id});
$thisSection.find('.section-published-date').html(html);
$thisSection.find('.section-published-date').animate({
'background-color': 'rgb(182,37,104)'
}, 300).animate({
Expand Down
12 changes: 6 additions & 6 deletions cms/static/js/models/settings/course_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
// A bit funny in that the video key validation is asynchronous; so, it won't stop the validation.
var errors = {};
if (newattrs.start_date === null) {
errors.start_date = "The course must have an assigned start date.";
errors.start_date = gettext("The course must have an assigned start date.");
}
if (newattrs.start_date && newattrs.end_date && newattrs.start_date >= newattrs.end_date) {
errors.end_date = "The course end date cannot be before the course start date.";
errors.end_date = gettext("The course end date cannot be before the course start date.");
}
if (newattrs.start_date && newattrs.enrollment_start && newattrs.start_date < newattrs.enrollment_start) {
errors.enrollment_start = "The course start date cannot be before the enrollment start date.";
errors.enrollment_start = gettext("The course start date cannot be before the enrollment start date.");
}
if (newattrs.enrollment_start && newattrs.enrollment_end && newattrs.enrollment_start >= newattrs.enrollment_end) {
errors.enrollment_end = "The enrollment start date cannot be after the enrollment end date.";
errors.enrollment_end = gettext("The enrollment start date cannot be after the enrollment end date.");
}
if (newattrs.end_date && newattrs.enrollment_end && newattrs.end_date < newattrs.enrollment_end) {
errors.enrollment_end = "The enrollment end date cannot be after the course end date.";
errors.enrollment_end = gettext("The enrollment end date cannot be after the course end date.");
}
if (newattrs.intro_video && newattrs.intro_video !== this.get('intro_video')) {
if (this._videokey_illegal_chars.exec(newattrs.intro_video)) {
errors.intro_video = "Key should only contain letters, numbers, _, or -";
errors.intro_video = gettext("Key should only contain letters, numbers, _, or -");
}
// TODO check if key points to a real video using google's youtube api
}
Expand Down
12 changes: 7 additions & 5 deletions cms/static/js/models/settings/course_grading_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
// FIXME somehow this.collection is unbound sometimes. I can't track down when
var existing = this.collection && this.collection.some(function(other) { return (other != this) && (other.get('type') == attrs['type']);}, this);
if (existing) {
errors.type = "There's already another assignment type with this name.";
errors.type = gettext("There's already another assignment type with this name.");
}
}
}
if (attrs['weight']) {
if (!isFinite(attrs.weight) || /\D+/.test(attrs.weight)) {
errors.weight = "Please enter an integer between 0 and 100.";
errors.weight = gettext("Please enter an integer between 0 and 100.");
}
else {
attrs.weight = parseInt(attrs.weight); // see if this ensures value saved is int
Expand All @@ -99,18 +99,20 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
}}
if (attrs['min_count']) {
if (!isFinite(attrs.min_count) || /\D+/.test(attrs.min_count)) {
errors.min_count = "Please enter an integer.";
errors.min_count = gettext("Please enter an integer.");
}
else attrs.min_count = parseInt(attrs.min_count);
}
if (attrs['drop_count']) {
if (!isFinite(attrs.drop_count) || /\D+/.test(attrs.drop_count)) {
errors.drop_count = "Please enter an integer.";
errors.drop_count = gettext("Please enter an integer.");
}
else attrs.drop_count = parseInt(attrs.drop_count);
}
if (attrs['min_count'] && attrs['drop_count'] && attrs.drop_count > attrs.min_count) {
errors.drop_count = "Cannot drop more " + attrs.type + " than will assigned.";
errors.drop_count = _.template(
gettext("Cannot drop more <%= attrs.type %> than will assigned."),
attrs, {variable: 'attrs'});
}
if (!_.isEmpty(errors)) return errors;
}
Expand Down
10 changes: 5 additions & 5 deletions cms/static/js/views/textbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CMS.Views.ShowTextbook = Backbone.View.extend({
if(e && e.preventDefault) { e.preventDefault(); }
var textbook = this.model, collection = this.model.collection;
var msg = new CMS.Views.Prompt.Warning({
title: _.str.sprintf(gettext("Delete “%s”?"),
textbook.escape('name')),
title: _.template(gettext("Delete “<%= name %>”?"),
{name: textbook.escape('name')}),
message: gettext("Deleting a textbook cannot be undone and once deleted any reference to it in your courseware's navigation will also be removed."),
actions: {
primary: {
Expand Down Expand Up @@ -241,8 +241,8 @@ CMS.Views.EditChapter = Backbone.View.extend({
asset_path: this.$("input.chapter-asset-path").val()
});
var msg = new CMS.Models.FileUpload({
title: _.str.sprintf(gettext("Upload a new asset to %s"),
section.escape('name')),
title: _.template(gettext("Upload a new asset to “<%= name %>”"),
{name: section.escape('name')}),
message: "Files must be in PDF format."
});
var view = new CMS.Views.UploadDialog({model: msg, chapter: this.model});
Expand All @@ -260,7 +260,7 @@ CMS.Views.UploadDialog = Backbone.View.extend({
this.listenTo(this.model, "change", this.render);
},
render: function() {
var isValid = this.model.isValid()
var isValid = this.model.isValid();
var selectedFile = this.model.get('selectedFile');
var oldInput = this.$("input[type=file]").get(0);
this.$el.html(this.template({
Expand Down
13 changes: 9 additions & 4 deletions cms/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="base.html" />
<%block name="title">Page Not Found</%block>
<%block name="title">${_("Page Not Found")}</%block>

<%block name="content">

<div class="wrapper-content wrapper">
<section class="content">

<h1>Page not found</h1>
<p>The page that you were looking for was not found. Go back to the <a href="/">homepage</a> or let us know about any pages that may have been moved at <a href="mailto:technical@edx.org">technical@edx.org</a>.</p>
<h1>${_("Page not found")}</h1>
<p>${_('The page that you were looking for was not found.')}
${_('Go back to the {homepage} or let us know about any pages that may have been moved at {email}.').format(
homepage='<a href="/">homepage</a>',
email='<a href="mailto:technical@edx.org">technical@edx.org</a>')}
</p>
</section>
</div>

</%block>
</%block>
13 changes: 7 additions & 6 deletions cms/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="base.html" />

<%block name="title">Studio Server Error</%block>
<%block name="title">${_("Studio Server Error")}</%block>

<%block name="content">

<div class="wrapper-content wrapper">
<section class="content">
<h1>The <em>Studio</em> servers encountered an error</h1>
<h1>${_("The <em>Studio</em> servers encountered an error")}</h1>
<p>
An error occurred in Studio and the page could not be loaded. Please try again in a few moments.
We've logged the error and our staff is currently working to resolve this error as soon as possible.
If the problem persists, please email us at <a href="mailto:technical@edx.org">technical@edx.org</a>.
${_("An error occurred in Studio and the page could not be loaded. Please try again in a few moments.")}
${_("We've logged the error and our staff is currently working to resolve this error as soon as possible.")}
${_('If the problem persists, please email us at {email}.').format(email='<a href="mailto:technical@edx.org">technical@edx.org</a>')}
</p>
</section>
</div>

</%block>
</%block>
7 changes: 4 additions & 3 deletions cms/templates/activation_active.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="base.html" />

<%block name="content">
Expand All @@ -6,9 +7,9 @@
<div>

<section class="activation">
<h1>Account already active!</h1>
<p> This account has already been activated. <a href="/signin">Log in here</a>.</p>
<h1>${_("Account already active!")}</h1>
<p>${_('This account has already been activated.')}<a href="/signin">${_("Log in here.")}</a></p>
</div>
</section>

</%block>
</%block>
7 changes: 4 additions & 3 deletions cms/templates/activation_complete.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="base.html" />

<%block name="content">

<section class="tos">
<div>
<h1>Activation Complete!</h1>
<p>Thanks for activating your account. <a href="/signin">Log in here</a>.</p>
<h1>${_("Activation Complete!")}</h1>
<p>${_('Thanks for activating your account.')}<a href="/signin">${_("Log in here.")}</a></p>
</div>
</section>

</%block>
</%block>
Loading