Merge pull request #11161 from edx/asadiqbal08/WL-270

WL-270 used gettext in javascript files
This commit is contained in:
Matt Drayer
2016-01-07 10:45:12 -05:00
2 changed files with 9 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
define(["backbone", "backbone.associations"], function(Backbone) {
define(["backbone", "gettext", "backbone.associations"], function(Backbone, gettext) {
var Chapter = Backbone.AssociatedModel.extend({
defaults: function() {
return {
@@ -32,17 +32,17 @@ define(["backbone", "backbone.associations"], function(Backbone) {
validate: function(attrs, options) {
if(!attrs.name && !attrs.asset_path) {
return {
message: "Chapter name and asset_path are both required",
message: gettext("Chapter name and asset_path are both required"),
attributes: {name: true, asset_path: true}
};
} else if(!attrs.name) {
return {
message: "Chapter name is required",
message: gettext("Chapter name is required"),
attributes: {name: true}
};
} else if (!attrs.asset_path) {
return {
message: "asset_path is required",
message: gettext("asset_path is required"),
attributes: {asset_path: true}
};
}

View File

@@ -1,6 +1,6 @@
define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
define(["backbone", "underscore", "gettext", "js/models/chapter", "js/collections/chapter",
"backbone.associations", "coffee/src/main"],
function(Backbone, _, ChapterModel, ChapterCollection) {
function(Backbone, _, gettext, ChapterModel, ChapterCollection) {
var Textbook = Backbone.AssociatedModel.extend({
defaults: function() {
@@ -60,13 +60,13 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
validate: function(attrs, options) {
if (!attrs.name) {
return {
message: "Textbook name is required",
message: gettext("Textbook name is required"),
attributes: {name: true}
};
}
if (attrs.chapters.length === 0) {
return {
message: "Please add at least one chapter",
message: gettext("Please add at least one chapter"),
attributes: {chapters: true}
};
} else {
@@ -79,7 +79,7 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
});
if(!_.isEmpty(invalidChapters)) {
return {
message: "All chapters must have a name and asset",
message: gettext("All chapters must have a name and asset"),
attributes: {chapters: invalidChapters}
};
}