Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert i18n stuff for now

Test Plan:
    blinky:/Users/eater/khan/eater/khan-exercises> git diff 3967e6a
    blinky:/Users/eater/khan/eater/khan-exercises>

Reviewers: alpert, cbhl

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D2061
  • Loading branch information...
commit b122474dc6c972cfcc2700bfbdb6ad682e70e970 1 parent 2de2385
Ben Eater beneater authored
4 exercises/arithmetic_word_problems_1.html
View
@@ -136,7 +136,7 @@
<div id="add-start">
<p class="problem">
Some cars were parked in the <var>store(1)</var> store parking lot.
- <var>NUM2</var> more <var>plural('car')</var> <var>plural('parks', NUM2)</var> at the <var>store(1)</var> store,
+ <var>NUM2</var> more <var>plural('car')</var> <var>plural('parks', 'park', NUM2)</var> at the <var>store(1)</var> store,
and now there <var>plural('is', TOTAL)</var> <var>plural(TOTAL, 'car')</var> in the parking lot.
</p>
<p class="question">
@@ -183,7 +183,7 @@
<div id="add-result">
<p class="problem">
<var>plural(NUM1, 'car')</var> <var>plural('was', NUM1)</var> in the <var>store(1)</var> store parking lot.
- <var>NUM2</var> more <var>plural('car', NUM2)</var> <var>plural('parks', NUM2)</var> at the <var>store(1)</var> store.
+ <var>NUM2</var> more <var>plural('car', NUM2)</var> <var>plural('parks', 'park', NUM2)</var> at the <var>store(1)</var> store.
</p>
<p class="question">
How many cars are in the parking lot now?
2  exercises/creating_bar_charts_1.html
View
@@ -117,7 +117,7 @@
<div class="hints">
<div data-each="DATA as INDEX, NUM">
<p>
- <code><var>NUM</var></code> <var>plural( RESPONDENT, NUM )</var> said their
+ <code><var>NUM</var></code> <var>plural( RESPONDENT, NUM )</var> said <var>plural( randFromArray([ "his", "her" ]), "their", NUM )</var>
favorite <var>SUBJECT</var> was <var>CATEGORIES[ INDEX ]</var>.
<span data-if="NUM > 0">
So the top of the bar for "<span style="text-transform: capitalize"><var>CATEGORIES[ INDEX ]</var></span>" should line up with the number
28 exercises/least_common_multiple_and_greatest_common_divisor_word_problems.html
View
@@ -379,12 +379,7 @@
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( A ) as F" class="hint_blue">
- <span data-if="F === 1">
- 1 team with <var>plural( A, "sprinter" )</var><br />
- </span>
- <span data-else>
- <var>plural( F, "team" )</var> with <var>plural( A / F, "sprinter" )</var> each<br />
- </span>
+ <var>plural( F, "team" )</var> with <var>plural( A / F, "sprinter" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
@@ -402,12 +397,7 @@
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( B ) as F" class="hint_green">
- <span data-if="F === 1">
- 1 team with <var>plural( B, "long-distance runner" )</var><br />
- </span>
- <span data-else>
- <var>plural( F, "team" )</var> with <var>plural( B / F, "long-distance runner" )</var> each<br />
- </span>
+ <var>plural( F, "team" )</var> with <var>plural( B / F, "long-distance runner" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
@@ -514,12 +504,7 @@
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( A ) as F" class="hint_blue">
- <span data-if="F === 1">
- 1 basket with <var>plural( A, "chocolate chip cookie" )</var><br />
- </span>
- <span data-else>
- <var>plural( F, "basket" )</var> with <var>plural( A / F, "chocolate chip cookie" )</var> each<br />
- </span>
+ <var>plural( F, "basket" )</var> with <var>plural( A / F, "chocolate chip cookie" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
@@ -537,12 +522,7 @@
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( B ) as F" class="hint_green">
- <span data-if="F === 1">
- 1 basket with <var>plural( B, "oatmeal cookie" )</var><br />
- </span>
- <span data-else>
- <var>plural( F, "basket" )</var> with <var>plural( B / F, "oatmeal cookie" )</var> each<br />
- </span>
+ <var>plural( F, "basket" )</var> with <var>plural( B / F, "oatmeal cookie" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
2  exercises/reading_stem_and_leaf_plots.html
View
@@ -163,7 +163,7 @@
<span data-if="TYPE === 'smallest'">The <var>LOCATION</var> with the fewest <var>plural( ITEM )</var> had <var>plural( SOLUTION, ITEM )</var>.</span>
<span data-else-if="TYPE === 'largest'">The <var>LOCATION</var> with the most <var>plural( ITEM )</var> had <var>plural( SOLUTION, ITEM)</var>.</span>
<span data-else>
- <var>plural( SOLUTION, LOCATION )</var> had
+ <var>plural( SOLUTION, LOCATION )</var> <var>plural( "has", "have", SOLUTION )</var>
<span data-if="TYPE === 'how-many'">exactly</span>
<span data-if="TYPE === 'less-than'">fewer than</span>
<span data-if="TYPE === 'greater-than'">more than</span>
22 exercises/visualizing_derivatives.html
View
@@ -34,22 +34,12 @@
</div>
<div class="question">
- <div data-if="MOVE_DERIVATIVE" data-unwrap>
- <p>
- A function <code>f(x)</code> is shown in <span class="hint_purple" style="font-weight: bold">purple</span>. The <span class="hint_green" style="font-weight: bold">sliding green window</span> may contain a section of <b>its derivative <code>f'(x)</code></b>.
- </p>
- <p>
- Where does the function in the sliding window correspond to <code><b>f'(x)</b></code>?
- </p>
- </div>
- <div data-else data-unwrap>
- <p>
- A function <code>f(x)</code> is shown in <span class="hint_green" style="font-weight: bold">green</span>. The <span class="hint_purple" style="font-weight: bold">sliding purple window</span> may contain a section of <b>an antiderivative of the function, <code>F(x)</code></b>.
- </p>
- <p>
- Where does the function in the sliding window correspond to <code><b>F(x)</b></code>?
- </p>
- </div>
+ <p>
+ A function <code>f(x)</code> is shown in <span data-if="MOVE_DERIVATIVE" class="hint_purple" style="font-weight: bold">purple</span><span data-else class="hint_green" style="font-weight: bold">green</span>. The <span data-if="MOVE_DERIVATIVE" class="hint_green" style="font-weight: bold">sliding green window</span><span data-else class="hint_purple" style="font-weight: bold">sliding purple window</span> may contain a section of <b><var>MOVE_DERIVATIVE ? "its derivative" : "an antiderivative of the function,"</var> <code><var>MOVE_DERIVATIVE ? "f'(x)" : "F(x)"</var></code></b>.
+ </p>
+ <p>
+ Where does the function in the sliding window correspond to <code><b><var>MOVE_DERIVATIVE ? "f'(x)" : "F(x)"</var></b></code>?
+ </p>
</div>
<div class="problem">
181 khan-exercise.js
View
@@ -263,23 +263,17 @@ var Khan = (function() {
// "Check answer" or in assessmentMode "Submit answer" - set in prepareSite
originalCheckAnswerText = "",
- issueError = function() {
- return $._("Communication with GitHub isn't working. Please file " +
- "the issue manually at <a href=\"" +
- "http://github.com/Khan/khan-exercises/issues/new\">GitHub</a>. " +
- "Please reference exercise: %s.", exerciseId);
- },
+ issueError = "Communication with GitHub isn't working. Please file " +
+ "the issue manually at <a href=\"" +
+ "http://github.com/Khan/khan-exercises/issues/new\">GitHub</a>. " +
+ "Please reference exercise: " + exerciseId + ".",
issueSuccess = function(url, title, suggestion) {
- return $._("Thank you for your feedback! Your issue has been created " +
- "and can be found at the following link: " +
- "<p><a id=\"issue-link\" href=\"%s\">%s</a><p>%s</p>",
- url, title, suggestion);
- },
- issueIntro = function() {
- return $._("Remember to check the hints and double check your " +
- "math. All provided information will be public. Thanks for " +
- "your help!");
+ return ["Thank you for your feedback! Your issue has been created and can be ",
+ "found at the following link:",
+ "<p><a id=\"issue-link\" href=\"", url, "\">", title, "</a>",
+ "<p>", suggestion, "</p>"].join("");
},
+ issueIntro = "Remember to check the hints and double check your math. All provided information will be public. Thanks for your help!",
gae_bingo = window.gae_bingo || { bingo: function() {} },
@@ -350,9 +344,8 @@ var Khan = (function() {
},
warnTimeout: function() {
- warn($._("Your internet might be too slow to see an exercise. " +
- "Refresh the page or <a href='' id='warn-report'>report " +
- "a problem</a>."), false);
+ warn("Your internet might be too slow to see an exercise. Refresh the page " +
+ 'or <a href="" id="warn-report">report a problem</a>.', false);
$("#warn-report").click(function(e) {
e.preventDefault();
$("#report").click();
@@ -360,13 +353,12 @@ var Khan = (function() {
},
warnFont: function() {
- var enableFontDownload =
- $._("enable font download in your browser");
+ var enableFontDownload = "enable font download in your browser";
if ($.browser.msie) {
- enableFontDownload = $._('<a href="http://missmarcialee.com/2011/08/how-to-enable-font-download-in-internet-explorer-8/" target="_blank">enable font download</a>');
+ enableFontDownload = '<a href="http://missmarcialee.com/2011/08/how-to-enable-font-download-in-internet-explorer-8/" target="_blank">enable font download</a>';
}
- warn($._("You should %s to improve the appearance of math expressions.", enableFontDownload), true);
+ warn("You should " + enableFontDownload + " to improve the appearance of math expressions.", true);
},
// TODO(alpert): This doesn't need to be in the Khan object.
@@ -378,7 +370,7 @@ var Khan = (function() {
// Base modules required for every problem
mods.push(
- "i18n", "answer-types", "tmpl", "jquery.adhesion",
+ "answer-types", "tmpl", "jquery.adhesion",
"hints", "calculator"
);
@@ -710,10 +702,7 @@ var Khan = (function() {
},
showSolutionButtonText: function() {
- return hintsUsed ?
- $.ngettext("Show next step (%s left)",
- "Show next step (%s left)", hints.length) :
- $._("Show Solution");
+ return hintsUsed ? "Show next step (" + hints.length + " left)" : "Show Solution";
}
};
@@ -743,7 +732,7 @@ var Khan = (function() {
} else {
onjQueryLoaded();
}
-
+
function onjQueryLoaded() {
// If there are any requests left in the queue when the window unloads
// then we will have permanently lost their answers and will need to
@@ -933,7 +922,7 @@ var Khan = (function() {
$("#check-answer-button")
.attr("disabled", "disabled")
.addClass("buttonDisabled")
- .val($._("Please wait..."));
+ .val("Please wait...");
}
// TODO(alpert): Merge with loadExercise
@@ -1384,18 +1373,15 @@ var Khan = (function() {
if (typeof userExercise !== "undefined" && userExercise.readOnly) {
if (!userExercise.current) {
- warn($._("This exercise may have changed since it was " +
- "completed"), true);
+ warn("This exercise may have changed since it was completed", true);
}
var timelineEvents, timeline;
var timelinecontainer = $("<div id='timelinecontainer'>")
.append("<div>\n" +
- "<div id='previous-problem' class='simple-button'>" +
- $._("Previous Problem") + "</div>\n" +
- "<div id='previous-step' class='simple-button'><span>" +
- $._("Previous Step") + "</span></div>\n" +
+ "<div id='previous-problem' class='simple-button'>Previous Problem</div>\n" +
+ "<div id='previous-step' class='simple-button'><span>Previous Step</span></div>\n" +
"</div>")
.insertBefore("#problem-and-answer");
@@ -1456,10 +1442,8 @@ var Khan = (function() {
timelinecontainer
.append("<div>\n" +
- "<div id='next-problem' class='simple-button'>" +
- $._("Next Problem") + "</div>\n" +
- "<div id='next-step' class='simple-button'><span>" +
- $._("Next Step") + "</span></div>\n" +
+ "<div id='next-problem' class='simple-button'>Next Problem</div>\n" +
+ "<div id='next-step' class='simple-button'><span>Next Step</span></div>\n" +
"</div>");
$("<div class='user-activity correct-activity'>Started</div>")
@@ -1478,31 +1462,29 @@ var Khan = (function() {
thissolutionarea;
timelineEvents
- .append("<div class='timeline-time'>" +
- $.ngettext("%ss", "%ss", value[2]) + "</div>");
+ .append("<div class='timeline-time'>" + value[2] + "s</div>");
thissolutionarea = $("<div>")
.addClass("user-activity " + value[0])
.appendTo(timelineEvents);
if (value[0] === "hint-activity") {
- thissolutionarea.attr("title", $._("Hint used"));
+ thissolutionarea.attr("title", "Hint used");
thissolutionarea
.data("hint", hintNumber)
- .prepend($.ngettext("Hint #%s", "Hint #%s", hintNumber + 1));
+ .prepend("Hint #" + (hintNumber + 1));
hintNumber += 1;
} else { // This panel is a solution (or the first panel)
thissolutionarea.data("hint", false);
if (guess === "Activity Unavailable") {
- thissolutionarea.text($._("Activity Unavailable"));
+ thissolutionarea.text(guess);
} else {
// radio and custom are the only answer types that
// can't display its own guesses in the activity bar
if (answerType === "radio") {
thissolutionarea.append(
// Add the guess to the activity bar
- $("<p class='solution'>" + guess +
- "</p>").tmpl()
+ $("<p class='solution'>" + guess + "</p>").tmpl()
);
if (index === userExercise.userActivity.length - 1) {
@@ -1510,11 +1492,9 @@ var Khan = (function() {
.removeClass("incorrect-activity")
.addClass("correct-activity");
- thissolutionarea.attr("title",
- $._("Correct Answer"));
+ thissolutionarea.attr("title", "Correct Answer");
} else {
- thissolutionarea.attr("title",
- $._("Incorrect Answer"));
+ thissolutionarea.attr("title", "Incorrect Answer");
}
} else if (answerType === "custom") {
if (index === userExercise.userActivity.length - 1) {
@@ -1522,18 +1502,14 @@ var Khan = (function() {
.removeClass("incorrect-activity")
.addClass("correct-activity");
- thissolutionarea.attr("title",
- $._("Correct Answer"));
+ thissolutionarea.attr("title", "Correct Answer");
thissolutionarea.append(
- $("<p class='solution'>" +
- $._("Answer correct") + "</p>")
+ $("<p class='solution'>Answer correct</p>")
);
} else {
- thissolutionarea.attr("title",
- $._("Incorrect Answer"));
+ thissolutionarea.attr("title", "Incorrect Answer");
thissolutionarea.append(
- $("<p class='solution'>" +
- $._("Answer incorrect") + "</p>")
+ $("<p class='solution'>Answer incorrect</p>")
);
}
} else {
@@ -1548,14 +1524,12 @@ var Khan = (function() {
.removeClass("incorrect-activity")
.addClass("correct-activity");
- thissolutionarea.attr("title",
- $._("Correct Answer"));
+ thissolutionarea.attr("title", "Correct Answer");
} else {
thissolutionarea
.removeClass("correct-activity")
.addClass("incorrect-activity");
- thissolutionarea.attr("title",
- $._("Incorrect Answer"));
+ thissolutionarea.attr("title", "Incorrect Answer");
}
}
@@ -1617,7 +1591,7 @@ var Khan = (function() {
// This thing looks ridiculous above about 100px
if (maxHeight > 100) {
timelineEvents.children('.correct-activity, .incorrect-activity').each(function() {
- $(this).text($._('Answer'));
+ $(this).text('Answer');
});
} else if (maxHeight > timelinecontainer.height()) {
timelinecontainer.height(maxHeight);
@@ -1799,8 +1773,9 @@ var Khan = (function() {
if (userExercise == null || Khan.query.debug != null) {
- $("#problem-permalink")
- .text($._("Permalink: %s #%s", problemID, problemSeed))
+ $("#problem-permalink").text("Permalink: "
+ + problemID + " #"
+ + problemSeed)
.attr("href", window.location.protocol + "//" + window.location.host + window.location.pathname + "?debug&problem=" + problemID + "&seed=" + problemSeed);
}
@@ -1832,16 +1807,16 @@ var Khan = (function() {
if (!Khan.query.activity) {
var historyURL = debugURL + "&seed=" + problemSeed + "&activity=";
- $("<a>" + $._("Problem history") + "</a>").attr("href", "javascript:").click(function(event) {
+ $("<a>Problem history</a>").attr("href", "javascript:").click(function(event) {
window.location.href = historyURL + encodeURIComponent(JSON.stringify(userActivityLog));
}).appendTo(links);
} else {
- $("<a>" + $._("Random problem") + "</a>")
+ $("<a>Random problem</a>")
.attr("href", window.location.protocol + "//" + window.location.host + window.location.pathname + "?debug")
.appendTo(links);
}
- links.append("<br><b>" + $._("Problem types:") + "</b><br>");
+ links.append("<br><b>Problem types:</b><br>");
exercises.children(".problems").children().each(function(n, prob) {
var probID = $(prob).attr("id") || n;
@@ -1865,8 +1840,7 @@ var Khan = (function() {
// If this is a child exercise, show which one it came from
if (exercise.data("name") !== exerciseId) {
links.append("<br>");
- links.append($._("Original exercise: %s",
- exercise.data("name")));
+ links.append("Original exercise: " + exercise.data("name"));
}
if ($.tmpl.DATA_ENSURE_LOOPS > 0) {
@@ -1952,15 +1926,14 @@ var Khan = (function() {
if (answerType === "text" || answerType === "number") {
var checkAnswerButton = $("#check-answer-button");
checkAnswerButton.attr("disabled", "disabled").attr(
- "title", $._("Type in an answer first."));
+ "title", "Type in an answer first.");
// Enables the check answer button - added so that people who type
// in a number and hit enter quickly do not have to wait for the
// button to be enabled by the key up
$("#solutionarea")
.on("keypress.emptyAnswer", function(e) {
if (e.keyCode !== 13) {
- checkAnswerButton
- .removeAttr("disabled").removeAttr("title");
+ checkAnswerButton.removeAttr("disabled").removeAttr("title");
}
})
.on("keyup.emptyAnswer", function(e) {
@@ -2008,8 +1981,8 @@ var Khan = (function() {
if (testMode && Khan.query.test != null && dataDump.problems.length + dataDump.issues >= problemCount) {
// Show the dump data
$("#problemarea").append(
- $._("<p>Thanks! You're all done testing this exercise.</p>" +
- "<p>Please copy the text below and send it to us.</p>")
+ "<p>Thanks! You're all done testing this exercise.</p>" +
+ "<p>Please copy the text below and send it to us.</p>"
);
$("<textarea>")
@@ -2218,13 +2191,10 @@ var Khan = (function() {
// Warn user about problem, encourage to reload page
warn(
- $._("This page is out of date. You need to " +
- "<a href='%s'>refresh</a>, but don't worry, you " +
- "haven't lost progress. If you think this is a " +
- "mistake, <a href='%s'>tell us</a>.",
- window.location.href,
- "http://www.khanacademy.org/reportissue" +
- "?type=Defect&issue_labels=")
+ "This page is out of date. You need to <a href='" + window.location.href +
+ "'>refresh</a>, but don't worry, you haven't lost progress. " +
+ "If you think this is a mistake, " +
+ "<a href='http://www.khanacademy.org/reportissue?type=Defect&issue_labels='>tell us</a>."
);
}, "attempt_hint_queue");
@@ -2324,8 +2294,6 @@ var Khan = (function() {
} else if (behavior === "angle-mode") {
Calculator.angleMode = Calculator.angleMode === "DEG" ?
"RAD" : "DEG";
- // TODO(jeresig): i18n This renders DEG/RAD, should this
- // be translated? and how?
jel.html((Calculator.angleMode === "DEG" ? "<br>" : "")
+ Calculator.angleMode);
} else if (behavior === "evaluate") {
@@ -2374,11 +2342,8 @@ var Khan = (function() {
hintsUsed += 1;
- var stepsLeft = $.ngettext("%s step left", "%s steps left",
- hints.length);
- $(this).val($(this).data("buttonText") ||
- $.ngettext("I'd like another hint (%s)",
- "I'd like another hint (%s)", stepsLeft));
+ var stepsLeft = hints.length + " step" + (hints.length === 1 ? "" : "s") + " left";
+ $(this).val($(this).data("buttonText") || "I'd like another hint (" + stepsLeft + ")");
var problem = $(hint).parent();
@@ -2416,7 +2381,7 @@ var Khan = (function() {
// On an exercise page, replace the "Report a Problem" link with a button
// to be more clear that it won't replace the current page.
- $("<a>" + $._("Report a Problem") + "</a>")
+ $("<a>Report a Problem</a>")
.attr("id", "report").addClass("simple-button green")
.replaceAll($(".footer-links #report"));
@@ -2430,7 +2395,7 @@ var Khan = (function() {
if (report && form) {
$("#issue").hide();
} else if (!report || !form) {
- $("#issue-status").removeClass("error").html(issueIntro());
+ $("#issue-status").removeClass("error").html(issueIntro);
$("#issue, #issue form").show();
$("html, body").animate({
scrollTop: $("#issue").offset().top
@@ -2513,17 +2478,14 @@ var Khan = (function() {
if (!type) {
$("#issue-status").addClass("error")
- .html($._("Please specify the issue type.")).show();
+ .html("Please specify the issue type.").show();
return;
} else {
labels.push(type.slice("issue-".length));
- var hintOrVideoMsg = $._("Please click the hint button above " +
- "to see our solution, or watch a video for " +
- "additional help.");
- var refreshOrBrowserMsg = $._("Please try a hard refresh " +
- "(press Ctrl + Shift + R) or use Khan Academy from a " +
- "different browser (such as Chrome or Firefox).");
+ var hintOrVideoMsg = "Please click the hint button above to see our solution, or watch a video for additional help.";
+ var refreshOrBrowserMsg = "Please try a hard refresh (press Ctrl + Shift + R)" +
+ " or use Khan Academy from a different browser (such as Chrome or Firefox).";
var suggestion = {
"issue-wrong-or-unclear": hintOrVideoMsg,
"issue-hard": hintOrVideoMsg,
@@ -2534,8 +2496,7 @@ var Khan = (function() {
if (title === "") {
$("#issue-status").addClass("error")
- .html($._("Please provide a valid title " +
- "for the issue.")).show();
+ .html("Please provide a valid title for the issue.").show();
return;
}
@@ -2590,7 +2551,7 @@ var Khan = (function() {
// show status message
$("#issue-status").addClass("error")
- .html(issueError()).show();
+ .html(issueError).show();
// enable the inputs
formElements.attr("disabled", false);
@@ -2629,15 +2590,12 @@ var Khan = (function() {
if (testMode && Khan.query.test != null) {
$("#answer_area").prepend(
'<div id="tester-info" class="info-box">' +
- '<span class="info-box-header">' + $._('Testing Mode') +
- '</span><p><strong>' + $._('Problem No.') +
- '</strong> <span class="problem-no"></span></p>' +
- '<p><strong>' + $._('Answer:') +
- '</strong> <span class="answer"></span></p><p>' +
- '<input type="button" class="pass simple-button green" value="' +
- $._('This problem was generated correctly.') + '">' +
- '<input type="button" class="fail simple-button orange" value="' +
- $._('There is an error in this problem.') + '">' +
+ '<span class="info-box-header">Testing Mode</span>' +
+ '<p><strong>Problem No.</strong> <span class="problem-no"></span></p>' +
+ '<p><strong>Answer:</strong> <span class="answer"></span></p>' +
+ "<p>" +
+ '<input type="button" class="pass simple-button green" value="This problem was generated correctly.">' +
+ '<input type="button" class="fail simple-button orange" value="There is an error in this problem.">' +
"</p>" +
"</div>"
);
@@ -2649,8 +2607,7 @@ var Khan = (function() {
});
$("#tester-info .fail").click(function() {
- var description = prompt(
- $._("Please provide a short description of the error"));
+ var description = prompt("Please provide a short description of the error");
// Don't do anything on clicking Cancel
if (description == null) return;
60 utils/answer-types.js
View
@@ -141,45 +141,45 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
// retrieve the example texts from the different forms
var exampleForms = {
- integer: $._("an integer, like <code>6</code>"),
+ integer: "an integer, like <code>6</code>",
proper: (function() {
if (options.simplify === "optional") {
- return $._("a <em>proper</em> fraction, like " +
- "<code>1/2</code> or <code>6/10</code>");
+ return "a <em>proper</em> fraction, like " +
+ "<code>1/2</code> or <code>6/10</code>";
} else {
- return $._("a <em>simplified proper</em> " +
- "fraction, like <code>3/5</code>");
+ return "a <em>simplified proper</em> fraction, " +
+ "like <code>3/5</code>";
}
})(),
improper: (function() {
if (options.simplify === "optional") {
- return $._("an <em>improper</em> fraction, like " +
- "<code>10/7</code> or <code>14/8</code>");
+ return "an <em>improper</em> fraction, like " +
+ "<code>10/7</code> or <code>14/8</code>";
} else {
return "a <em>simplified improper</em> " +
"fraction, like <code>7/4</code>";
}
})(),
- pi: $._("a multiple of pi, like <code>12\\ \\text{pi}</code> " +
- "or <code>2/3\\ \\text{pi}</code>"),
+ pi: "a multiple of pi, like <code>12\\ \\text{pi}</code> or " +
+ "<code>2/3\\ \\text{pi}</code>",
- log: $._("an expression, like <code>\\log(100)</code>"),
+ log: "an expression, like <code>\\log(100)</code>",
- percent: $._("a percent, like <code>12.34\\%</code>"),
+ percent: "a percent, like <code>12.34\\%</code>",
- dollar: $._("a money amount, like <code>$2.75</code>"),
+ dollar: "a money amount, like <code>$2.75</code>",
- mixed: $._("a mixed number, like <code>1\\ 3/4</code>"),
+ mixed: "a mixed number, like <code>1\\ 3/4</code>",
decimal: (function() {
if (options.inexact === undefined) {
- return $._("an <em>exact</em> decimal, like " +
- "<code>0.75</code>");
+ return "an <em>exact</em> decimal, like " +
+ "<code>0.75</code>";
} else {
- return $._("a decimal, like <code>0.75</code>");
+ return "a decimal, like <code>0.75</code>";
}
})()
};
@@ -514,12 +514,12 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
ret = true;
} else if (form === "percent") {
// Otherwise, an error was returned
- ret = $._("Your answer is almost correct, " +
- "but it is missing a <code>\\%</code> at " +
- "the end.");
+ ret = "Your answer is almost correct, but " +
+ "it is missing a <code>\\%</code> at " +
+ "the end.";
} else {
- ret = $._("Your answer is almost correct, " +
- "but it needs to be simplified.");
+ ret = "Your answer is almost correct, but " +
+ "it needs to be simplified.";
}
return false; // break;
@@ -654,10 +654,10 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
},
solution: ans,
examples: (options.simplify === "required") ?
- [$._("a simplified radical, like <code>\\sqrt{2}</code> " +
- "or <code>3\\sqrt{5}</code>")] :
- [$._("a radical, like <code>\\sqrt{8}</code> or " +
- "<code>2\\sqrt{2}</code>")],
+ ["a simplified radical, like <code>\\sqrt{2}</code> or " +
+ "<code>3\\sqrt{5}</code>"] :
+ ["a radical, like <code>\\sqrt{8}</code> or " +
+ "<code>2\\sqrt{2}</code>"],
showGuess: function(guess) {
inte.val(guess ? guess[0] : "");
rad.val(guess ? guess[1] : "");
@@ -691,8 +691,8 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
if (simplified || options.simplify === "optional") {
return true;
} else {
- return $._("Your answer is almost correct, but it " +
- "needs to be simplified.");
+ return "Your answer is almost correct, but it needs " +
+ "to be simplified.";
}
} else {
return false;
@@ -1402,9 +1402,9 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
},
solution: $.trim($(solution).text()),
examples: [
- $._("a product of prime factors, like " +
- "<code>2 \\times 3</code>"),
- $._("a single prime number, like <code>5</code>")
+ "a product of prime factors, like " +
+ "<code>2 \\times 3</code>",
+ "a single prime number, like <code>5</code>"
],
showGuess: function(guess) {
input.val(guess === undefined ? "" : guess);
15 utils/calculator.js
View
@@ -361,7 +361,7 @@ return new Parser;
CalculatorError.prototype.constructor = CalculatorError;
parser.parseError = function parseError(str, hash) {
- throw new CalculatorError($._("err"));
+ throw new CalculatorError("err");
};
return _.bindAll({
@@ -386,7 +386,7 @@ return new Parser;
if (ans != null) {
return ans;
} else {
- throw new CalculatorError($._("Invalid variable ans"));
+ throw new CalculatorError("Invalid variable ans");
}
} else if (_.isNumber(tree)) {
return tree;
@@ -411,21 +411,21 @@ return new Parser;
asin: function(a) {
var ans = fromRad(Math.asin(a));
if (isNaN(ans)) {
- throw new CalculatorError($._("undefined"));
+ throw new CalculatorError("undefined");
}
return ans;
},
acos: function(a) {
var ans = fromRad(Math.acos(a));
if (isNaN(ans)) {
- throw new CalculatorError($._("undefined"));
+ throw new CalculatorError("undefined");
}
return ans;
},
atan: function(a) {
var ans = fromRad(Math.atan(a));
if (isNaN(ans)) {
- throw new CalculatorError($._("undefined"));
+ throw new CalculatorError("undefined");
}
return ans;
}
@@ -437,12 +437,11 @@ return new Parser;
this, _.map(tree.slice(1), function(t) {
return self.evaluate(t, ans); }));
} else {
- throw new CalculatorError($._("err"));
+ throw new CalculatorError("err");
}
} else {
throw new CalculatorError(
- $._("Invalid type %s",
- Object.prototype.toString.call(tree)));
+ "Invalid type " + Object.prototype.toString.call(tree));
}
},
4 utils/chemistry.js
View
@@ -1,6 +1,4 @@
$.fn["chemistryLoad"] = function() {
- // TODO(jeresig): i18n: Currently the names of the atomic elements aren't
- // being used in the UI, but if they are, they will need to be translated.
var elements = {
"Hydrogen": {
"symbol" : "H",
@@ -2601,7 +2599,7 @@ $.fn["chemistryLoad"] = function() {
};
var periodicTable = $("<div>").appendTo("body");
- periodicTable.attr("title", $._("Periodic table of the elements"));
+ periodicTable.attr("title", "Periodic table of the elements");
periodicTable.dialog({
autoOpen: false,
show: "fade",
55 utils/factoring-expressions.js
View
@@ -63,21 +63,17 @@
KhanUtil.exprSetStyle(termB.initial, KhanUtil.BLUE)]};
var initialForm = KhanUtil.parseFormat("#{a^2} - #{b^2}", [KhanUtil.PINK, KhanUtil.BLUE]);
var factoredForm = KhanUtil.parseFormat("(#a + #b)(#a - #b)", [KhanUtil.PINK, KhanUtil.BLUE, KhanUtil.PINK, KhanUtil.BLUE]);
- hints.push($._("<p><code>%s</code></p><p>The expression is of the " +
- "form <code>%s</code> which is a difference of two squares so we " +
- "can factor it as <code>%s</code></p>",
- KhanUtil.format(coloredExpr), initialForm, factoredForm));
+ hints.push("<p><code>" + KhanUtil.format(coloredExpr) + "</code></p><p>The expression is of the form <code>" + initialForm +
+ "</code> which is a difference of two squares so we can factor it as <code>" + factoredForm + "</code></p>");
var strA = KhanUtil.parseFormat("#a", [KhanUtil.PINK]);
var strB = KhanUtil.parseFormat("#b", [KhanUtil.BLUE]);
- hints.push($._("<p>What are the values of <code>%s</code> and <code>%s</code>?</p>", strA, strB));
+ hints.push("<p>What are the values of <code>" + strA + "</code> and <code>" + strB + "</code>?</p>");
var varA = {op: "var", args: ["a"]};
var varB = {op: "var", args: ["b"]};
var exprA = {op: "=", args: [varA, {op: "sqrt", args: [termA.initial]}, termA.sqrt], style: KhanUtil.PINK};
var exprB = {op: "=", args: [varB, {op: "sqrt", args: [termB.initial]}, termB.sqrt], style: KhanUtil.BLUE};
hints.push("<p><code>" + KhanUtil.format(exprA) + "</code><p><code>" + KhanUtil.format(exprB) + "</code></p>");
- hints.push($._("<p>Use the values we found for <code>%s</code> and " +
- "<code>%s</code> to complete the factored expression, " +
- "<code>%s</code></p>", strA, strB, factoredForm));
+ hints.push("<p>Use the values we found for <code>" + strA + "</code> and <code>" + strB + "</code> to complete the factored expression, <code>" + factoredForm + "</code></p>");
var coloredFactored = KhanUtil.exprClone(solution);
for (var iArg1 = 0; iArg1 < 2; iArg1++) {
var colors = [KhanUtil.PINK, KhanUtil.BLUE];
@@ -85,8 +81,7 @@
coloredFactored.args[iArg1].args[iArg2] = KhanUtil.exprSetStyle(coloredFactored.args[iArg1].args[iArg2], colors[iArg2]);
}
}
- hints.push($._("<p><b>So we can factor the expression as:</b> " +
- "<code>%s</code></p>", KhanUtil.format(coloredFactored)));
+ hints.push("<p><b>So we can factor the expression as:</b><code>" + KhanUtil.format(coloredFactored) + "</code>");
}
return {solution: solution, hints: hints};
};
@@ -318,13 +313,10 @@
}
var hint = "<span class='factoring-expressions'></span>";
if (listFactors.length === 1) {
- return hint + $._("<p>The terms have one common factor: %s.</p>",
- strListFactors);
+ return hint + "<p>The terms have one common factor: " + strListFactors + ".</p>";
} else {
var gcf = KhanUtil.format(KhanUtil.exprSetStyle(KhanUtil.genExprFromExpFactors(factors, occFactors), KhanUtil.BLUE));
- return hint + $._("<p>The terms have these common factors: %s, so " +
- "the greatest common factor is <code>%s</code>.</p>",
- strListFactors, gcf);
+ return hint + "<p>The terms have these common factors: " + strListFactors + ", so the greatest common factor is <code>" + gcf + "</code>.</p>";
}
};
@@ -338,9 +330,7 @@
}
expr = KhanUtil.simplify(expr, KhanUtil.simplifyOptions.checkInput);
- hints.push($._("<p><code>%s</code></p><p>We start by decomposing " +
- "each term into a product of its most simple factors.</p>",
- KhanUtil.format(expr)));
+ hints.push("<p><code>" + KhanUtil.format(expr) + "</code></p><p>We start by decomposing each term into a product of its most simple factors.</p>");
for (var iTerm = 0; iTerm < nbTerms; iTerm++) {
var mergedOccFactors = mergeOccFactors(sharedOccFactors, termsOccFactors[iTerm]);
@@ -350,13 +340,8 @@
}
hints.push(genHintListFactors(factors, sharedOccFactors));
- hints.push($._("<p>We can rewrite the expression as: " +
- "<code>%s</code>.</p>",
- KhanUtil.format({op: "+", args: genAllTermsMarkShared(factors,
- sharedOccFactors, termsOccFactors, colors)})));
- hints.push($._("<p>We now rewrite the expression as a product: " +
- "<code>%s</code>.</p>", KhanUtil.format(genFullExpr(factors,
- sharedOccFactors, termsOccFactors, true))));
+ hints.push("<p>We can rewrite the expression as: <code>" + KhanUtil.format({op: "+", args: genAllTermsMarkShared(factors, sharedOccFactors, termsOccFactors, colors)}) + "</code>.</p>");
+ hints.push("<p>We now rewrite the expression as a product: <code>" + KhanUtil.format(genFullExpr(factors, sharedOccFactors, termsOccFactors, true)) + "</code>.</p>");
return hints;
};
@@ -398,30 +383,24 @@
var sharedOccFactors = exprFactors.sharedOccFactors;
var termsOccFactors = exprFactors.termsOccFactors;
- var hints = [$._("<p>To factor this expression, we start by looking at the different terms of the sum and find all of their common factors. We can then rewrite the expression as a product between these common factors and what's left of the different terms once we remove these factors.</p>")];
+ var hints = ["<p>To factor this expression, we start by looking at the different terms of the sum and find all of their common factors. We can then rewrite the expression as a product between these common factors and what's left of the different terms once we remove these factors.</p>"];
var detailedHints = genHintsDecomposeAllFactors(factors, sharedOccFactors, termsOccFactors);
var solution = genFullExpr(factors, sharedOccFactors, termsOccFactors);
if (options.factorDiffOfSquares) {
- var hint = $._("<p>We obtain the following expression: %s</p>",
- KhanUtil.getSubHints("common-factors",
- $._("Show explanation"), detailedHints));
+ var hint = "<p>We obtain the following expression: " + KhanUtil.getSubHints("common-factors", "Show explanation", detailedHints);
hint += "<p><code>" + KhanUtil.format(solution) + "</code></p>";
hints.push(hint);
- hints.push($._("<p>Can we factor this expression even more?</p>"));
+ hints.push("<p>Can we factor this expression even more?</p>");
for (var iArg = 0; iArg < solution.args.length; iArg++) {
var arg = solution.args[iArg];
var solvedArg = solveDiffOfSquaresExercise(arg, options);
if (solvedArg === undefined) {
continue;
}
- hints.push($._("<p>This part of the expression can be factored: " +
- "<code>%s</code></p>", KhanUtil.format(arg)));
- var hint = $._("<p>We recognize and factor a difference of " +
- "squares, and obtain the following expression: %s</p>",
- KhanUtil.getSubHints("diff-squares-" + iArg,
- $._("Show explanation"), solvedArg.hints));
+ hints.push("<p>This part of the expression can be factored: <code>" + KhanUtil.format(arg) + "</code></p>");
+ var hint = "<p>We recognize and factor a difference of squares, and obtain the following expression: " + KhanUtil.getSubHints("diff-squares-" + iArg, "Show explanation", solvedArg.hints);
solution.args[iArg] = solvedArg.solution;
hint += "<p><code>" + KhanUtil.format(solution);
hints.push(hint);
@@ -440,9 +419,7 @@
} else if (options.factorWithDiffOfSquares === "(ab^2-cd^2)=a(b - d)(b + d)") {
}
- hints.push($._("<p class='final_answer'>There is nothing left to " +
- "factor using this approach. The answer is : <code>%s</code></p>",
- KhanUtil.format(solution)));
+ hints.push("<p class='final_answer'>There is nothing left to factor using this approach. The answer is : <code>" + KhanUtil.format(solution) + "</code></p>");
return {hints: hints, solution: solution};
};
31 utils/graphie-helpers-arithmetic.js
View
@@ -514,12 +514,12 @@ function Multiplier(a, b, digitsA, digitsB, deciA, deciB) {
var x = -maxNumDigits;
var y = -digitsB.length * digitsA.length;
graph.label([x, y + 2],
- $.ngettext("\\text{The top number has 1 digit to the right of the decimal.}", "\\text{The top number has %s digits to the right of the decimal.}", deciA), "right");
+ "\\text{The top number has " + KhanUtil.plural(deciA, "digit") + " to the right of the decimal.}", "right");
graph.label([x, y + 1],
- $.ngettext("\\text{The bottom number has 1 digit to the right of the decimal.}", "\\text{The bottom number has %s digits to the right of the decimal.}", deciB), "right");
- // TODO(jeresig): i18n: Should this be pluralized?
+ "\\text{The bottom number has " + KhanUtil.plural(deciB, "digit") + " to the right of the decimal.}", "right");
graph.label([x, y],
- $._("\\text{The product has %s + %s = %s digits to the right of the decimal.}", deciA, deciB, deciA + deciB), "right");
+ "\\text{The product has " + deciA + " + " + deciB + " = " + (deciA + deciB)
+ + " digits to the right of the decimal.}", "right");
graph.style({
fill: "#000"
}, function() {
@@ -597,9 +597,11 @@ function Divider(divisor, dividend, deciDivisor, deciDividend) {
highlights = highlights.concat(drawDigits(totalDigits, index - totalDigits.length + 1, -2 * index, KhanUtil.BLUE));
graph.label([digitsDividend.length + 0.5, -2 * index],
- $._("\\text{How many times does }%s" +
- "\\text{ go into }\\color{#6495ED}{%s}\\text{?}",
- divisor, total), "right");
+ "\\text{How many times does }"
+ + divisor
+ + "\\text{ go into }"
+ + "\\color{#6495ED}{" + total + "}"
+ + "\\text{?}", "right");
fShowFirstHalf = false;
} else {
@@ -629,8 +631,7 @@ function Divider(divisor, dividend, deciDivisor, deciDividend) {
+ "\\div"
+ divisor + "="
+ "\\color{#28AE7B}{" + quotient + "}"
- // TODO(jeresig): i18n: Should this be the whole expression?
- + $._("\\text{ or }")
+ + "\\text{ or }"
+ divisor
+ "\\times"
+ "\\color{#28AE7B}{" + quotient + "}"
@@ -650,8 +651,7 @@ function Divider(divisor, dividend, deciDivisor, deciDividend) {
this.addDecimal();
this.show();
graph.label([digitsDividend.length, 1],
- $._("\\text{Write in a decimal and a zero and continue dividing.}"),
- "right");
+ "\\text{Write in a decimal and a zero and continue dividing.}", "right");
};
this.getNumHints = function() {
@@ -680,20 +680,17 @@ function Divider(divisor, dividend, deciDivisor, deciDividend) {
if (deciDivisor !== 0) {
graph.label([digitsDividend.length + 1 + (deciDiff > 0 ? deciDiff : 0), 1],
- $.ngettext("\\text{Shift the decimal %s to the right.}",
- "\\text{Shift the decimal %s to the right.}",
- deciDivisor), "right");
+ "\\text{Shift the decimal " + deciDivisor + " to the right.}", "right");
graph.style({
fill: "#000"
}, function() {
graph.ellipse([-1, -0.2], [0.08, 0.04]);
});
} else {
- // TODO(jeresig): i18n: This probably won't work in multiple langs
graph.label([digitsDividend.length + 0.5, 1.2],
- $._("\\text{Bring the decimal up into the}"), "right");
+ "\\text{Bring the decimal up into the}", "right");
graph.label([digitsDividend.length + 0.5, 0.8],
- $._("\\text{answer (the quotient).}"), "right");
+ "\\text{answer (the quotient).}", "right");
}
this.addDecimal();
2  utils/hints.js
View
@@ -26,7 +26,7 @@ $(Khan).bind("newProblem", function() {
$("#hint")
.removeClass("green")
.addClass("orange")
- .val($._("I'd like a hint"))
+ .val("I'd like a hint")
.data("buttonText", false)
.stop(true /* clear */, true /* jump */)
.appendTo("#get-hint-button-container");
36 utils/i18n.js
View
@@ -1,36 +0,0 @@
-/**
- * Simple i18n method with sprintf-like %s replacement
- */
-jQuery._ = function(str) {
- var replaces = Array.prototype.slice.call(arguments, 1);
- var obj = replaces[0] || {};
-
- str = str.replace(/%s/g, function(all) {
- var retVal = replaces.shift();
- return retVal === undefined ? all : retVal;
- });
-
- return str.replace(/%\(([\w_]+)\)s/g, function(all, name) {
- var retVal = obj[name];
- return retVal === undefined ? all : retVal;
- });
-};
-
-jQuery.ngettext = function(single, plural, num) {
- var replaces = Array.prototype.slice.call(arguments, 2);
- var obj = replaces[1] || {};
-
- // TODO(jeresig): i18n: Replace this with real i18n logic, likely from Jed
- var str = num === 1 ? single : plural;
-
- str = str.replace(/%s/g, function(all) {
- var retVal = replaces.shift();
- return retVal === undefined ? all : retVal;
- });
-
- return str.replace(/%\(([\w_]+)\)s/g, function(all, name) {
- var retVal = obj[name] || num;
- return retVal === undefined ? all : retVal;
- });
-};
-
31 utils/math-format.js
View
@@ -234,23 +234,9 @@ $.extend(KhanUtil, {
// Ported from https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/cl_format.clj#L285
cardinal: function(n) {
- // TODO(jeresig): i18n: Is this something that can be ported?
- var cardinalScales = ["", $._("thousand"), $._("million"),
- $._("billion"), $._("trillion"), $._("quadrillion"),
- $._("quintillion"), $._("sextillion"), $._("septillion"),
- $._("octillion"), $._("nonillion"), $._("decillion"),
- $._("undecillion"), $._("duodecillion"), $._("tredecillion"),
- $._("quattuordecillion"), $._("quindecillion"),
- $._("sexdecillion"), $._("septendecillion"), $._("octodecillion"),
- $._("novemdecillion"), $._("vigintillion")];
- var cardinalUnits = [$._("zero"), $._("one"), $._("two"), $._("three"),
- $._("four"), $._("five"), $._("six"), $._("seven"), $._("eight"),
- $._("nine"), $._("ten"), $._("eleven"), $._("twelve"),
- $._("thirteen"), $._("fourteen"), $._("fifteen"), $._("sixteen"),
- $._("seventeen"), $._("eighteen"), $._("nineteen")];
- var cardinalTens = ["", "", $._("twenty"), $._("thirty"), $._("forty"),
- $._("fifty"), $._("sixty"), $._("seventy"), $._("eighty"),
- $._("ninety")];
+ var cardinalScales = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "quattuordecillion", "quindecillion", "sexdecillion", "septendecillion", "octodecillion", "novemdecillion", "vigintillion"];
+ var cardinalUnits = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
+ var cardinalTens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
// For formatting numbers less than 1000
var smallNumberWords = function(n) {
var hundredDigit = Math.floor(n / 100);
@@ -258,11 +244,9 @@ $.extend(KhanUtil, {
var str = "";
if (hundredDigit) {
- str += $.ngettext("%s hundred", "%s hundred",
- cardinalUnits[hundredDigit]);
+ str += cardinalUnits[hundredDigit] + " hundred";
}
- // TODO(jeresig): i18n: This will need to changed
if (hundredDigit && rest) {
str += " ";
}
@@ -278,7 +262,6 @@ $.extend(KhanUtil, {
str += cardinalTens[tenDigit];
}
- // TODO(jeresig): i18n: This will need to changed
if (tenDigit && unitDigit) {
str += "-";
}
@@ -293,7 +276,7 @@ $.extend(KhanUtil, {
};
if (n === 0) {
- return $._("zero");
+ return "zero";
} else {
var neg = false;
if (n < 0) {
@@ -319,10 +302,9 @@ $.extend(KhanUtil, {
}
if (neg) {
- words.unshift($._("negative"));
+ words.unshift("negative");
}
- // TODO(jeresig): i18n: This will need to changed
return words.join(" ");
}
},
@@ -472,7 +454,6 @@ $.extend(KhanUtil, {
},
randVar: function() {
- // NOTE(jeresig): i18n: I assume it's OK to have roman letters here
return KhanUtil.randFromArray(["x", "k", "y", "a", "n", "r", "p", "u", "v"]);
},
7 utils/math.js
View
@@ -58,11 +58,8 @@ $.extend(KhanUtil, {
return digits;
},
- // TODO(jeresig): i18n: Does this make sense?
- placesLeftOfDecimal: [$._("one"), $._("ten"), $._("hundred"),
- $._("thousand")],
- placesRightOfDecimal: [$._("one"), $._("tenth"), $._("hundredth"),
- $._("thousandth")],
+ placesLeftOfDecimal: ["one", "ten", "hundred", "thousand"],
+ placesRightOfDecimal: ["one", "tenth", "hundredth", "thousandth"],
powerToPlace: function(power) {
if (power < 0) {
6 utils/mean-and-median.js
View
@@ -14,8 +14,7 @@ $.extend(KhanUtil, {
);
graph.graph.meanLabel.remove();
- graph.graph.meanLabel = graph.label([mean, 1.3], $._("\\text{mean}"),
- "above", { color: KhanUtil.BLUE });
+ graph.graph.meanLabel = graph.label([mean, 1.3], "\\text{mean}", "above", { color: KhanUtil.BLUE });
graph.graph.mean = mean;
},
@@ -33,8 +32,7 @@ $.extend(KhanUtil, {
);
graph.graph.medianLabel.remove();
- graph.graph.medianLabel = graph.label([median, -1.7],
- $._("\\text{median}"), "below", { color: KhanUtil.GREEN });
+ graph.graph.medianLabel = graph.label([median, -1.7], "\\text{median}", "below", { color: KhanUtil.GREEN });
graph.graph.median = median;
},
10 utils/polynomials.js
View
@@ -360,14 +360,14 @@ $.extend(KhanUtil, {
var composedFuncWithVal = composed.name + "(" + val + ")";
- hints.push($._("<p>To solve for the value of <code>%s</code>, " +
- "we need to solve for the value of <code>%s</code>.</p>",
- this.name, composedFuncWithVal));
+ hints.push("<p>To solve for the value of <code>" + this.name + "</code>,"
+ + "we need to solve for the value of <code>"
+ + composedFuncWithVal + "</code>.</p>");
hints = hints.concat(composed.hint(val));
- hints.push($._("<p>That means <code>%s(%s) = %s</code></p>",
- this.name, val, this.hintEvalOf(val, true)));
+ hints.push("<p>That means <code>" + this.name + "(" + val + ") = " +
+ this.hintEvalOf(val, true) + "</code></p>");
hints.push("<p><code>" + this.name + "(" + val + ") = " +
this.evalOf(val) + "</code></p>");
7 utils/probability.js
View
@@ -1,7 +1,6 @@
$.extend(KhanUtil, {
/* coinFlips(2) returns
* [["HH", 2], ["HT", 1], ["TH", 1], ["TT", 0]] */
- // TODO(jeresig): i18n: Does this make sense for i18n?
coinFlips: function(n) {
if (n === 0) {
return [["", 0]];
@@ -11,15 +10,13 @@ $.extend(KhanUtil, {
var andAHead = $.map(preceding, function(_arg, i) {
var seq = _arg[0];
var h = _arg[1];
- // I18N: Represents "heads" on a coin
- return [[$._("H") + seq, h + 1]];
+ return [["H" + seq, h + 1]];
});
var andATail = $.map(preceding, function(_arg, i) {
var seq = _arg[0];
var h = _arg[1];
- // I18N: Represents "tails" on a coin
- return [[$._("T") + seq, h]];
+ return [["T" + seq, h]];
});
return andAHead.concat(andATail);
4 utils/qhints.js
View
@@ -29,10 +29,10 @@ $.fn["qhintsLoad"] = function() {
if (!source) {
feedback.text(answer);
} else if (userInput === answer) {
- feedback.text($._("Correct! The answer is %s.", answer))
+ feedback.text("Correct! The answer is " + answer + ".")
.addClass("correct");
} else {
- feedback.text($._("Incorrect. The answer is %s.", answer))
+ feedback.text("Incorrect. The answer is " + answer + ".")
.addClass("incorrect");
}
57 utils/simplify.js
View
@@ -17,8 +17,7 @@
} else {
prodExpr = KhanUtil.moveSameOpsUp({op: "*", args: newArgs});
}
- var subSteps = new KhanUtil.StepsProblem([], prodExpr,
- $._("simplify"), true);
+ var subSteps = new KhanUtil.StepsProblem([], prodExpr, "simplify", true);
options.mergeCstFactors = false;
prodExpr = simplify(prodExpr, options, subSteps);
options.mergeCstFactors = true;
@@ -28,8 +27,7 @@
var cstFactor1 = {op: "*", args: [splitExpr1.numExpr, splitExpr1.cstExpr]};
var cstFactor2 = {op: "*", args: [splitExpr2.numExpr, splitExpr2.cstExpr]};
var sumFactors = {op: "+", args: [cstFactor1, cstFactor2]};
- var subSteps = new KhanUtil.StepsProblem([], sumFactors,
- $._("simplify"), true);
+ var subSteps = new KhanUtil.StepsProblem([], sumFactors, "simplify", true);
var cstFactor = simplify(sumFactors, options, subSteps);
//steps.add(subSteps);
return {op: "*", args: [cstFactor, splitExpr1.varExpr]};
@@ -64,8 +62,7 @@
};
var simplifySingleArg = function(expr, options, steps) {
- var subSteps = new KhanUtil.StepsProblem([0], expr.args[0],
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([0], expr.args[0], "simplify");
var sArg = simplify(expr.args[0], options, subSteps);
steps.add(subSteps);
return KhanUtil.exprCopyMissingStyle(expr, {op: expr.op, args: [sArg]});
@@ -74,8 +71,7 @@
var simplifyEachArg = function(expr, options, steps) {
var newExpr = KhanUtil.exprClone(expr);
for (var iArg = 0; iArg < newExpr.args.length; iArg++) {
- var subSteps = new KhanUtil.StepsProblem([iArg], newExpr.args[iArg],
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([iArg], newExpr.args[iArg], "simplify");
var sArg = simplify(newExpr.args[iArg], options, subSteps);
subSteps.endExpr = sArg;
if (steps === undefined) {
@@ -364,13 +360,11 @@
newExpr = {op: "*", args: newArgs};
}
if (options.expandProducts) {
- var subSteps1 = new KhanUtil.StepsProblem([], newExpr,
- $._("expandProduct"), true);
+ var subSteps1 = new KhanUtil.StepsProblem([], newExpr, "expandProduct", true);
var expanded = expandProduct(newExpr, subSteps1);
steps.add(subSteps1);
if (expanded.op === "+") {
- var subSteps2 = new KhanUtil.StepsProblem([], expanded,
- $._("simplify"), true);
+ var subSteps2 = new KhanUtil.StepsProblem([], expanded, "simplify", true);
var sExpanded = simplify(expanded, options, subSteps2);
steps.add(subSteps2);
return sExpanded;
@@ -409,8 +403,7 @@
var simplificationOps = {
"+": function(expr, options, steps) {
var sExpr1 = KhanUtil.moveSameOpsUp(expr);
- var subSteps = new KhanUtil.StepsProblem([], sExpr1,
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([], sExpr1, "simplify");
var sExpr = simplifyEachArg(sExpr1, options, steps);
steps.add(sExpr);
sExpr = KhanUtil.moveSameOpsUp(sExpr);
@@ -496,10 +489,8 @@
newExpr = factoredExpr;
}
} else {
- steps.add(
- $._("<p>The expression %s can be factored as %s</p>",
- KhanUtil.exprToCode(expr),
- KhanUtil.exprToCode(newExpr)));
+ steps.add("<p>The expression " + KhanUtil.exprToCode(expr) + " can be factored as " +
+ KhanUtil.exprToCode(newExpr) + "</p>");
}
}
expr = KhanUtil.exprCopyMissingStyle(expr, newExpr);
@@ -512,8 +503,7 @@
if ((expr.args.length === 2) && (options.changeSubIntoPlusNeg)) {
return {op: "+", args: [expr.args[0], {op: "-", args: [expr.args[1]]}]};
}
- var subSteps = new KhanUtil.StepsProblem([], expr,
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([], expr, "simplify");
var sExpr = simplifyEachArg(expr, options, steps);
if (expr.args.length === 1) {
var arg = sExpr.args[0];
@@ -537,23 +527,19 @@
"cdot": simplifyTimesOp,
"times": simplifyTimesOp,
"^": function(expr, options, steps) {
- var subSteps1 = new KhanUtil.StepsProblem([0], expr.args[0],
- $._("simplify"));
+ var subSteps1 = new KhanUtil.StepsProblem([0], expr.args[0], "simplify");
var term = simplify(expr.args[0], options, subSteps1);
steps.add(subSteps1);
- var subSteps2 = new KhanUtil.StepsProblem([1], expr.args[1],
- $._("simplify"));
+ var subSteps2 = new KhanUtil.StepsProblem([1], expr.args[1], "simplify");
var pow = simplify(expr.args[1], options, subSteps2);
steps.add(subSteps2);
if (options.mergePowerOfPower) {
while ((typeof term === "object") && (term.op === "^")) {
var curPow = {op: "*", args: [pow, term.args[1]]};
- var subSteps3 = new KhanUtil.StepsProblem([], curPow,
- $._("simplify"), true);
+ var subSteps3 = new KhanUtil.StepsProblem([], curPow, "simplify", true);
pow = simplify(curPow, options, subSteps3);
steps.add(subSteps3);
- var subSteps4 = new KhanUtil.StepsProblem([], term.args[0],
- $._("simplify"), true);
+ var subSteps4 = new KhanUtil.StepsProblem([], term.args[0], "simplify", true);
term = simplify(term.args[0], options, subSteps4);
steps.add(subSteps4);
}
@@ -590,16 +576,14 @@
var numer = sExpr.args[0];
var denom = sExpr.args[1];
sExpr = {op: "*", args: [numer, {op: "^", args: [denom, -1]}]};
- var subSteps = new KhanUtil.StepsProblem([], sExpr,
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([], sExpr, "simplify");
sExpr = simplify(sExpr, options, subSteps);
steps.add(subSteps);
}
return sExpr;
},
"ln": function(expr, options, steps) {
- var subSteps = new KhanUtil.StepsProblem([0], expr.args[0],
- $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([0], expr.args[0], "simplify");
var term = simplify(expr.args[0], options, subSteps);
steps.add(subSteps);
if (options.cancelLnExp && (typeof term === "object") && (term.op === "^") &&
@@ -615,8 +599,7 @@
return expr;
}
options.derivTerm = expr.args[1];
- var subSteps = new KhanUtil.StepsProblem([], expr.args[0],
- $._("differentiate"));
+ var subSteps = new KhanUtil.StepsProblem([], expr.args[0], "differentiate");
expr = KhanUtil.differentiate(expr.args[0], options, subSteps);
steps.add(subSteps);
options.derivTerm = oldDerivTerm;
@@ -774,7 +757,7 @@
var simplify = function(expr, options, steps) {
if (steps === undefined) {
- steps = new KhanUtil.StepsProblem([], expr, $._("simplify"));
+ steps = new KhanUtil.StepsProblem([], expr, "simplify");
}
if (options === undefined) {
options = {};
@@ -790,7 +773,7 @@
expr.text = KhanUtil.exprToText(expr);
if (!KhanUtil.exprIdentical(expr, steps.startExpr)) {
- var subSteps = new KhanUtil.StepsProblem([], expr, $._("simplify"));
+ var subSteps = new KhanUtil.StepsProblem([], expr, "simplify");
expr = KhanUtil.simplify(expr, options, subSteps);
steps.add(subSteps);
}
@@ -801,7 +784,7 @@
};
var simplifyWithHints = function(expr) {
- var steps = new KhanUtil.StepsProblem([], expr, $._("simplify"));
+ var steps = new KhanUtil.StepsProblem([], expr, "simplify");
var simp = simplify(expr, {}, steps);
var hints = KhanUtil.genHints(steps);
return {result: simp, hints: hints};
96 utils/simplifying-expressions.js
View
@@ -90,100 +90,55 @@
var exampleGroup = [KhanUtil.parse("#{\\dfrac{a^2}{a}} &= #{\\dfrac{#{a} \\cdot a}{#{a}}}", [KhanUtil.BLUE, KhanUtil.BLUE, {cancel: true}, {cancel: true}]),
KhanUtil.parse("&= #{\\dfrac{a}{1}}", [KhanUtil.BLUE]),
KhanUtil.parse("&= #{a}", [KhanUtil.BLUE])];
- steps.add(
- $._("<p>To simplify this type of expression, we need to " +
- "look for factors that are shared by both the numerator and " +
- "the denominator.</p>") +
- $._("<p>For each such factor, if it is present with the same " +
- "exponent both at the numerator and the denominator, then we" +
- " can remove that factor completely. If the exponent is " +
- "different, then we remove the one with the lowest exponent," +
- " and substract it from the one with the higher exponent.</p>")
- );
-
- var subHints = [
- $._("<p>Why can we simplify an expression this way? " +
- "Let's look at the detailed steps that we imply when we " +
- "write <code>%s</code> :</p>",
- KhanUtil.format(exampleExprStep)) +
- $._("<p><code>%s</code> can be rewritten as <code>%s</code></p>",
- KhanUtil.format(exampleExprInit), KhanUtil.parseFormat(
- "\\dfrac{3}{5} \\cdot #{\\dfrac{a^2}{a}} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE])) +
- "<p><code>" + KhanUtil.formatGroup(exampleGroup) + "</code></p>" +
- $._("<p>So we get <code>%s</code>, or <code>%s</code>",
- KhanUtil.parseFormat("\\dfrac{3}{5} \\cdot #{a} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]),
- KhanUtil.parseFormat("\\dfrac{3ab}{5c}"))
- ];
-
- steps.add(
- $._("<p>For example, if we had this expression: " +
- "<code>%s</code>, we would see that the factor " +
- "<code>%s</code> is present in both the numerator and the " +
- "denominator.</p>", KhanUtil.format(exampleExprInit),
- KhanUtil.format(aExpr)) +
- $._("<p>We would then simplify it like this: <code>%s</code> " +
- "and obtain: <code>%s</code> %s</p>",
- KhanUtil.format(exampleExprStep),
- KhanUtil.format(exampleExprEnd),
- KhanUtil.getSubHints("factoring",
- $._("Show explanation"), subHints)) +
- $._("<p>Can you apply this technique to this exercise?</p>")
- );
+ steps.add("<p>To simplify this type of expression, we need to look for factors that are shared by both the numerator and the denominator.</p>For each such factor, if it is present with the same exponent both at the numerator and the denominator, then we can remove that factor completely. If the exponent is different, then we remove the one with the lowest exponent, and substract it from the one with the higher exponent.</p>");
+ var subHints = ["<p>Why can we simplify an expression this way? Let's look at the detailed steps that we imply when we write <code>" + KhanUtil.format(exampleExprStep) + "</code> :</p><p><code>" + KhanUtil.format(exampleExprInit) + "</code> can be rewritten as <code>" +
+ KhanUtil.parseFormat("\\dfrac{3}{5} \\cdot #{\\dfrac{a^2}{a}} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code></p><p><code>" +
+ KhanUtil.formatGroup(exampleGroup) + "</code></p><p>So we get <code>" +
+ KhanUtil.parseFormat("\\dfrac{3}{5} \\cdot #{a} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code>, or <code>" +
+ KhanUtil.parseFormat("\\dfrac{3ab}{5c}") + "</code>"];
+ steps.add("<p>For example, if we had this expression: <code>" + KhanUtil.format(exampleExprInit) + "</code>, we would see that the factor <code>" + KhanUtil.format(aExpr) + "</code> is present in both the numerator and the denominator.</p><p>We would then simplify it like this: <code>" + KhanUtil.format(exampleExprStep) + "</code> and obtain: <code>" + KhanUtil.format(exampleExprEnd) + "</code> " + KhanUtil.getSubHints("factoring", "Show explanation", subHints) + "</p><p>Can you apply this technique to this exercise?</p>");
};
var factorNumeratorDenominator = function(expr, options, steps) {
var newArgs = [];
var wasSimplified = false;
for (var iArg = 0; iArg < 2; iArg++) {
- var subSteps = new KhanUtil.StepsProblem([0], expr.args[iArg],
- $._("simplify by factoring"));
+ var subSteps = new KhanUtil.StepsProblem([0], expr.args[iArg], "simplify by factoring");
var newArg = KhanUtil.simplify(expr.args[iArg], options, subSteps); // Récupérer les indices
var termName;
if (iArg === 0) {
- termName = $._("numerator");
+ termName = "numerator";
} else {
- termName = $._("denominator");
+ termName = "denominator";
}
if (KhanUtil.stepIsUsed(subSteps)) {
if (!wasSimplified) {
steps.add("<p>" + KhanUtil.exprToCode(expr) + "</p>");
}
- steps.add($._("<p>We can see that the %s can be factored " +
- "some more : %s<p>",
- termName, KhanUtil.exprToCode(expr.args[iArg])));
+ steps.add("<p>We can see that the " + termName + " can be factored some more : " + KhanUtil.exprToCode(expr.args[iArg]) + "<p>");
steps.add(subSteps);
- steps.add($._("<p>So the %s becomes : %s</p>",
- termName, KhanUtil.exprToCode(newArg)));
+ steps.add("<p>So the " + termName + " becomes : " + KhanUtil.exprToCode(newArg) + "</p>");
wasSimplified = true;
}
newArgs.push(newArg);
}
var newExpr = {op: expr.op, args: newArgs};
if (wasSimplified) {
- steps.add($._("<p>We obtain the following expression:</p>") +
- "<p>" + KhanUtil.exprToCode(newExpr) + "</p>");
+ steps.add("<p>We obtain the following expression :</p><p>" + KhanUtil.exprToCode(newExpr));
}
return newExpr;
};
var solveSimplifyingExpressionsExercise = function(expr) {
- var steps = new KhanUtil.StepsProblem([], expr,
- $._("simplify by factoring"));
+ var steps = new KhanUtil.StepsProblem([], expr, "simplify by factoring");
addInitialSteps(steps);
- var subSteps = new KhanUtil.StepsProblem([], expr,
- $._("factor numerator and denominator"));
+ var subSteps = new KhanUtil.StepsProblem([], expr, "factor numerator and denominator");
var options = KhanUtil.simplifyOptions.factor;
var newExpr = factorNumeratorDenominator(expr, options, subSteps);
if (KhanUtil.stepIsUsed(subSteps)) {
- steps.add(
- $._("The first step is to factor the numerator and " +
- "denominator, if possible: %s</p>",
- KhanUtil.getSubHints("factoring-num-denom",
- $._("Show explanation"),
- [KhanUtil.genOneHint(subSteps)])) +
- $._("<p>We obtain: %s</p>",
- KhanUtil.exprToCode(newExpr))
- );
+ steps.add("The first step is to factor the numerator and denominator, if possible : " +
+ KhanUtil.getSubHints("factoring-num-denom", "Show explanation", [KhanUtil.genOneHint(subSteps)]) + "</p>" +
+ "<p>We obtain : " + KhanUtil.exprToCode(newExpr) + "</p>");
}
var factors = [];
var argsOccFactors = [[], []];
@@ -223,19 +178,10 @@
var hintExpr = getFractionFromOccFactors(factors, newOccFactors, argsOccFactors);
if (KhanUtil.exprIdentical(newExpr, solExpr)) {
- steps.add(
- $._("<p class='final_answer'>There are no factors that can " +
- "be simplified in this expression, so the answer is: " +
- "<code>%s</code></p>", KhanUtil.format(solExpr)));
+ steps.add("<p class='final_answer'>There are no factors that can be simplified in this expression, so the answer is: <code>" + KhanUtil.format(solExpr) + "</code>");
} else {
- steps.add(
- $._("<p>Applying the approach described above gives " +
- "in this case:</p>") +
- "<p><code>" + KhanUtil.format(hintExpr) + "</code></p>");
- steps.add(
- $._("<p class='final_answer'>We obtain the following " +
- "expression:</p>") +
- "<p><code>" + KhanUtil.format(solExpr) + "</code></p>");
+ steps.add("<p>Applying the approach described above gives in this case:</p><p><code>" + KhanUtil.format(hintExpr) + "</code></p>");
+ steps.add("<p class='final_answer'>We obtain the following expression:</p><p><code>" + KhanUtil.format(solExpr) + "</code></p>");
}
var hints = KhanUtil.genHints(steps);
return {solution: solExpr, hints: hints, choices: choices};
9 utils/steps-helpers.js
View
@@ -37,16 +37,14 @@
//id = id + "-" + KhanUtil.random();
var html = "<div id='" + id + "' class='modal hide fade' style='width:400px;left:750px;position:fixed;'>" +
" <div class='modal-header'>" +
- " <a href='#' class='close'>&times;</a> " +
- $._("Definition: %s", title) +
+ " <a href='#' class='close'>&times;</a> Definition:" + title +
" </div>" +
" <div class='modal-body'>" +
content +
" </div>";
if (link !== undefined) {
html += " <div class='modal-footer'>" +
- " <a href='" + link + "' class='btn primary'>" +
- $._("Watch the video") + "</a>" +
+ " <a href='" + link + "' class='btn primary'>Watch the video</a>" +
" </div>";
}
html += "</div>" +
@@ -161,8 +159,7 @@
$.each(path, function(node) {
strPath += node + ", ";
});
- // NOTE(jeresig): Why is this a JavaScript expression?
- steps.add("putStepsInContext(" + KhanUtil.exprToCode(parentExpr) + ", [" + strPath + "])");
+ steps.add("putStepsInContect(" + KhanUtil.exprToCode(parentExpr) + ", [" + strPath + "])");
};
var putStepsInContext = function(parentExpr, path, steps) {
4 utils/tmpl.js
View
@@ -119,8 +119,8 @@ $.tmpl = {
youtubeIds = youtubeIds.split(/,\s*/);
var author = $(elem).data("video-hint-author") || "Sal";
- var msg = $._("Watch %s work through a very similar problem:",
- author);
+ var msg = "Watch " + author +
+ " work through a very similar problem:";
var preface = $("<p>").text(msg);
var wrapper = $("<div>", { "class": "video-hint" });
3  utils/triangle-congruence.js
View
@@ -542,8 +542,7 @@ $.extend(KhanUtil, {
};
};
- $(".question").prepend("<button id=\"reflect\">" +
- $._("Reflect shape") + "</button>");
+ $(".question").prepend("<button id=\"reflect\">Reflect shape</button>");
$("button#reflect").bind("click", function(event) {
this.blur();
if (!triangle.animating) {
42 utils/visualizing-derivatives.js
View
@@ -981,9 +981,7 @@ $.extend(KhanUtil, {
var self = this;
_.each(this.problem.fnArray, function(fn, i) {
- var nth = i > 0 ?
- $._("next") :
- $._("first");
+ var nth = i > 0 ? "next" : "first";
fn = fn.derivative();
@@ -991,39 +989,32 @@ $.extend(KhanUtil, {
var inc;
if (nCoefs === 1) {
if (fn.coefs[0] === 0) {
- inc = $._("zero");
+ inc = "zero";
} else if (fn.coefs[0] > 0) {
- inc = $._("constant and positive");
+ inc = "constant and positive";
} else {
- inc = $._("constant and negative");
+ inc = "constant and negative";
}
} else if (nCoefs === 2) {
+ if (fn.coefs[1] > 0) {
+ inc = "increasing";
+ } else {
+ inc = "decreasing";
+ }
var val = fn.evalOf(0) +
fn.evalOf(self.INTERVAL_WIDTH);
if (val >= 0) {
- if (fn.coefs[1] > 0) {
- inc = $._("increasing and positive");
- } else {
- inc = $._("decreasing and positive");
- }
+ inc += " and positive";
} else {
- if (fn.coefs[1] > 0) {
- inc = $._("increasing and negative");
- } else {
- inc = $._("decreasing and negative");
- }
+ inc += " and negative";
}
}
var hint;
if (moveDeriv) {
- hint = $._("The %s section of the derivative is %s, " +
- "so it corresponds to an original function whose " +
- "<b>slope</b> is %s.", nth, inc, inc);
+ hint = "The " + nth + " section of the derivative is " + inc + ", so it corresponds to an original function whose <b>slope</b> is " + inc + ".";
} else {
- hint = $._("The %s section of the antiderivative has a " +
- "%s slope, so it corresponds to an original " +
- "function that is %s.", nth, inc, inc);
+ hint = "The " + nth + " section of the antiderivative has a " + inc + " slope, so it corresponds to an original function that is " + inc + ".";
}
var hintproblem = self.problem.slice(i, i+1);
@@ -1036,9 +1027,7 @@ $.extend(KhanUtil, {
var lastHint;
if (this.noSolution) {
- lastHint = $._("Because these sections do not appear next " +
- "to each other in the graph of <code>f(x)</code>, " +
- "there is no solution.");
+ lastHint = "Because these sections do not appear next to each other in the graph of <code>f(x)</code>, there is no solution.";
hints.push("<p>" + lastHint + "</p>");
hints.push("<div class='graphie'> PROBLEM.showNoAnswer(); </div>");
} else {
@@ -1046,8 +1035,7 @@ $.extend(KhanUtil, {
return "<code>x \\in [" + range.join(", ") + "]</code>";
}).join(" and ");
var fnVar = moveDeriv ? "f'(x)" : "F(x)";
- lastHint = $._("The function in the window corresponds to " +
- "<code>%s</code> where %s.", fnVar, solnText);
+ lastHint = "The function in the window corresponds to <code>" + fnVar + "</code> where " + solnText + ".";
var firstAnswer = this.problemRanges[0][0];
hints.push("<p>" + lastHint + "</p>");
345 utils/word-problems.js
View
@@ -7,7 +7,6 @@
// but not across them.
$.extend(KhanUtil, {
- // TODO(jeresig): i18n: Figure out how this should be converted
toSentence: function(array, conjunction) {
if (conjunction == null) {
conjunction = "and";
@@ -38,219 +37,112 @@ $.extend(KhanUtil, {
return str.charAt(0).toUpperCase() + str.slice(1);
},
- // NOTE(jeresig): If you want to pluralize a word you must add it here!
- // Look-up table of plural word translations culled from exercise files
- // Makes it possible to actually extract these words for i18n
- plurals: {
- "badge": function(num) {
- return $.ngettext("badge", "badges", num);
- },
- "basket": function(num) {
- return $.ngettext("basket", "baskets", num);
- },
- "block": function(num) {
- return $.ngettext("block", "blocks", num);
- },
- "blue dot": function(num) {
- return $.ngettext("blue dot", "blue dots", num);
- },
- "car": function(num) {
- return $.ngettext("car", "cars", num);
- },
- "chocolate chip cookie": function(num) {
- return $.ngettext("chocolate chip cookie",
- "chocolate chip cookies", num);
- },
- "circle": function(num) {
- return $.ngettext("circle", "circles", num);
- },
- "cup": function(num) {
- return $.ngettext("cup", "cups", num);
- },
- "dollar": function(num) {
- return $.ngettext("dollar", "dollars", num);
- },
- "dot": function(num) {
- return $.ngettext("dot", "dots", num);
- },
- "foot": function(num) {
- return $.ngettext("foot", "feet", num);
- },
- "fourth": function(num) {
- return $.ngettext("fourth", "fourths", num);
- },
- "full symbol": function(num) {
- return $.ngettext("full symbol", "full symbols", num);
- },
- "green dot": function(num) {
- return $.ngettext("green dot", "green dots", num);
- },
- "hour": function(num) {
- return $.ngettext("hour", "hours", num);
- },
- "house point": function(num) {
- return $.ngettext("house point", "house points", num);
- },
- "hundred": function(num) {
- // I18N: As in the HUNDREDS position of a number
- return $.ngettext("hundred", "hundreds", num);
- },
- "hundredth": function(num) {
- // I18N: As in the HUNDREDTHS position of a number
- return $.ngettext("hundredth", "hundredths", num);
- },
- // TODO(jeresig): i18n: This may be a bad thing to pluralize
- "is": function(num) {
- return $.ngettext("is", "are", num);
- },
- "loaf": function(num) {
- return $.ngettext("loaf", "loaves", num);
- },
- "long-distance runner": function(num) {
- return $.ngettext("long-distance runner",
- "long-distance runners", num);
- },
- "molecule": function(num) {
- return $.ngettext("molecule", "molecules", num);
- },
- "number": function(num) {
- return $.ngettext("number", "numbers", num);
- },
- "oatmeal cookie": function(num) {
- return $.ngettext("oatmeal cookie", "oatmeal cookies", num);
- },
- "one": function(num) {
- // I18N: As in the ONES position of a number
- return $.ngettext("one", "ones", num);
- },
- "outcome": function(num) {
- return $.ngettext("outcome", "outcomes", num);
- },
- "package": function(num) {
- return $.ngettext("package", "packages", num);
- },
- "parks": function(num) {
- // I18N: As in "1 more car parks." vs. "3 more cars park."
- return $.ngettext("parks", "park", num);
- },
- "person": function(num) {
- return $.ngettext("person", "people", num);
- },
- "piece": function(num) {
- return $.ngettext("piece", "pieces", num);
- },
- "place": function(num) {
- return $.ngettext("place", "places", num);
- },
- "position": function(num) {
- return $.ngettext("position", "positions", num);
- },
- "potato": function(num) {
- return $.ngettext("potato", "potatoes", num);
- },
- "row": function(num) {
- return $.ngettext("row", "rows", num);
- },
- "quiz": function(num) {
- return $.ngettext("quiz", "quizzes", num);
- },
- "set": function(num) {
- return $.ngettext("set", "sets", num);
- },
- "shelf": function(num) {
- return $.ngettext("shelf", "shelves", num);
- },
- "side": function(num) {
- return $.ngettext("side", "sides", num);
- },
- "slice": function(num) {
- return $.ngettext("slice", "slices", num);
- },
- "sprinter": function(num) {
- return $.ngettext("sprinter", "sprinters", num);
- },
- "square foot": function(num) {
- return $.ngettext("square foot", "square feet", num);
- },
- "standard deviation": function(num) {
- return $.ngettext("standard deviation",
- "standard deviations", num);
- },
- "symbol": function(num) {
- return $.ngettext("symbol", "symbols", num);
- },
- "team": function(num) {
- return $.ngettext("team", "teams", num);
- },
- "ten": function(num) {
- // I18N: As in the TENS position of a number
- return $.ngettext("ten", "tens", num);
- },
- "tenth": function(num) {
- // I18N: As in the TENTHS position of a number
- return $.ngettext("tenth", "tenths", num);
- },
- "thousand": function(num) {
- // I18N: As in the THOUSANDS position of a number
- return $.ngettext("thousand", "thousands", num);
- },
- "thousandth": function(num) {
- // I18N: As in the THOUSANDTHS position of a number
- return $.ngettext("thousandth", "thousandths", num);
- },
- "tick mark": function(num) {
- return $.ngettext("tick mark", "tick marks", num);
- },
- "time": function(num) {
- return $.ngettext("time", "times", num);
- },
- "tomato": function(num) {
- return $.ngettext("tomato", "tomatoes", num);
- },
- "tree": function(num) {
- return $.ngettext("tree", "trees", num);
- },