Browse files

Manually i18nize all of the minor exercises

Summary:
Manually make modifications to all the exercises for i18n. Most of the problems revolved around:

- Wrapping Strings in variables or graphies with `$._`
- `data-if`s in the middle of sentences, that needed to be pulled out around the entire sentence
- Strings that needed to be put into Plural objects for pluralization
- Decoupling strings from logic

Test Plan:
Visit the changed exercises. Make sure the question renders
correctly and there are no javascript errors. Take all the hints and make sure
nothing is rendered incorrectly. Do the translations into box language, and
make sure that everything from the languages is boxy.

Reviewers: csilvers, john

Reviewed By: csilvers

CC: alpert, eater

Differential Revision: http://phabricator.khanacademy.org/D2504
  • Loading branch information...
1 parent 9b11aaf commit de19411ac1af929535be3331edab550051cc4f24 @xymostech xymostech committed Jun 3, 2013
Showing with 1,186 additions and 562 deletions.
  1. +2 −2 exercises/adding_and_subtracting_decimals_word_problems.html
  2. +40 −20 exercises/area_1.html
  3. +19 −7 exercises/area_of_parallelograms.html
  4. +40 −22 exercises/area_of_squares_and_rectangles.html
  5. +24 −14 exercises/area_of_triangles_1.html
  6. +22 −8 exercises/areas_of_trapezoids_rhombi_and_kites.html
  7. +4 −4 exercises/arithmetic_word_problems_1.html
  8. +7 −7 exercises/arithmetic_word_problems_2.html
  9. +4 −4 exercises/average_word_problems.html
  10. +4 −3 exercises/axis_of_symmetry.html
  11. +5 −5 exercises/coin_flip_sequences.html
  12. +35 −16 exercises/combinations_1.html
  13. +20 −8 exercises/comparing_improper_fractions_and_mixed_numbers.html
  14. +3 −3 exercises/completing_the_square_2.html
  15. +21 −14 exercises/congruency_postulates.html
  16. +6 −5 exercises/congruent_segments.html
  17. +8 −7 exercises/congruent_triangles_1.html
  18. +56 −9 exercises/counting_1.html
  19. +76 −35 exercises/creating_bar_charts_1.html
  20. +66 −24 exercises/defined_and_undefined_matrix_operations.html
  21. +24 −7 exercises/dice_probability.html
  22. +13 −8 exercises/direct_and_inverse_variation.html
  23. +13 −9 exercises/exploring_mean_and_median.html
  24. +7 −4 exercises/exponents_1.html
  25. +24 −11 exercises/graphing_points_2.html
  26. +1 −1 exercises/graphs_of_sine_and_cosine.html
  27. +1 −1 exercises/greatest_common_divisor_alternative.html
  28. +3 −3 exercises/herons_formula.html
  29. +13 −7 exercises/integer_sums.html
  30. +16 −8 exercises/limiting_reagent_stoichiometry.html
  31. +43 −37 exercises/line_graph_intuition.html
  32. +17 −6 exercises/multiplication_0.5.html
  33. +17 −6 exercises/multiplication_1.html
  34. +7 −7 exercises/number_properties_terminology_1.html
  35. +25 −15 exercises/perimeter_1.html
  36. +23 −13 exercises/perimeter_of_squares_and_rectangles.html
  37. +11 −8 exercises/plotting_the_line_of_best_fit.html
  38. +40 −34 exercises/points_lines_and_planes.html
  39. +1 −1 exercises/probability_with_perm_comb.html
  40. +8 −8 exercises/pythagorean_identities.html
  41. +3 −2 exercises/radical_equations.html
  42. +2 −1 exercises/reading_bar_charts_1.html
  43. +13 −6 exercises/reading_bar_charts_2.html
  44. +23 −15 exercises/reading_bar_charts_3.html
  45. +10 −2 exercises/reading_line_charts_1.html
  46. +14 −4 exercises/reading_pictographs_1.html
  47. +18 −8 exercises/reading_pictographs_2.html
  48. +74 −13 exercises/reading_tables_1.html
  49. +18 −4 exercises/rotation_of_polygons.html
  50. +5 −3 exercises/shaded_areas.html
  51. +25 −9 exercises/similar_triangles_1.html
  52. +15 −8 exercises/similar_triangles_2.html
  53. +9 −5 exercises/slope_of_a_line.html
  54. +5 −2 exercises/standard_deviation.html
  55. +64 −12 exercises/systems_of_equations_word_problems.html
  56. +6 −2 exercises/telling_time_0.5.html
  57. +43 −17 exercises/telling_time_2.html
  58. +4 −2 exercises/the_complex_plane.html
  59. +5 −3 exercises/triangle_inequality_theorem.html
  60. +6 −3 exercises/triangle_types.html
  61. +6 −6 exercises/trigonometry_1.5.html
  62. +6 −6 exercises/trigonometry_2.html
  63. +19 −3 exercises/understanding_moving_the_decimal.html
  64. +2 −2 exercises/unit_circle.html
  65. +13 −10 exercises/variance.html
  66. +1 −1 exercises/views_of_a_function.html
  67. +5 −2 utils/qhints.js
  68. +3 −0 utils/word-problems.js
View
4 exercises/adding_and_subtracting_decimals_word_problems.html
@@ -229,7 +229,7 @@
</div>
<div class="question spin">
- <p data-if="isMale(1)">{To get to school each morning|To get to work each morning|To visit his grandmother}, <var>person(1)</var> takes a <var>vehicle(1)</var> <var>distance_1</var> <var>plural_form(distance(1))</var> and a <var>vehicle(2)</var> <var>distance_2</var> <var>plural_form(distance(1))</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p><p data-else="">{To get to school each morning|To get to work each morning|To visit her grandmother}, <var>person(1)</var> takes a <var>vehicle(1)</var> <var>distance_1</var> <var>plural_form(distance(1))</var> and a <var>vehicle(2)</var> <var>distance_2</var> <var>plural_form(distance(1))</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p>
+ <p data-if="isMale(1)">{To get to school each morning|To get to work each morning|To visit his grandmother}, <var>person(1)</var> takes a <var>vehicle(1)</var> <var>distance_1</var> <var>plural_form(distance(1), distance_1)</var> and a <var>vehicle(2)</var> <var>distance_2</var> <var>plural_form(distance(1), distance_2)</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p><p data-else="">{To get to school each morning|To get to work each morning|To visit her grandmother}, <var>person(1)</var> takes a <var>vehicle(1)</var> <var>distance_1</var> <var>plural_form(distance(1), distance_1)</var> and a <var>vehicle(2)</var> <var>distance_2</var> <var>plural_form(distance(1), distance_2)</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p>
<p class="question">How many <var>plural_form(distance(1))</var> is <var>person(1)</var>'s journey in total?</p>
</div>
@@ -251,7 +251,7 @@
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.adder.showHint();
</div>
- <p class="final_answer"><var>person(1)</var> travels <var>solution</var> <var>plural_form(distance(1))</var> in total.</p>
+ <p class="final_answer"><var>person(1)</var> travels <var>solution</var> <var>plural_form(distance(1), solution)</var> in total.</p>
</div>
</div>
</div>
View
60 exercises/area_1.html
@@ -9,11 +9,21 @@
<div class="exercise">
<div class="vars">
<var id="UNIT,UNIT_TEXT">randFromArray([
- ["in", "inch"],
- ["ft", "foot"],
- ["m", "meter"],
- ["cm", "centimeter"],
- ["", "unit"]
+ ["in", new Plural(function(num) {
+ return $.ngettext("inch", "inches", num);
+ })],
+ ["ft", new Plural(function(num) {
+ return $.ngettext("foot", "feet", num);
+ })],
+ ["m", new Plural(function(num) {
+ return $.ngettext("meter", "meters", num);
+ })],
+ ["cm", new Plural(function(num) {
+ return $.ngettext("centimeter", "centimeters", num);
+ })],
+ ["", new Plural(function(num) {
+ return $.ngettext("unit", "units", num);
+ })]
])</var>
</div>
<div class="problems">
@@ -37,7 +47,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>S * S</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -61,12 +71,12 @@
The length is <var>S</var> <var>UNIT_TEXT</var> and
the width is <var>S</var> <var>UNIT_TEXT</var>, so the
area is <code><var>S</var>\times<var>S</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p><p data-else="">
- The length is <var>S</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var> and
- the width is <var>S</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var>, so the
+ The length is <var>S</var> <var>plural_form(UNIT_TEXT, S)</var> and
+ the width is <var>S</var> <var>plural_form(UNIT_TEXT, S)</var>, so the
area is <code><var>S</var>\times<var>S</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p>
</div>
<div>
@@ -76,7 +86,7 @@
</code></p>
<p>
We can also count <var>S * S</var>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p>
<div class="graphie" data-update="area">
_(S * S).times(function(n) {
@@ -111,7 +121,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>L * W</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -134,11 +144,21 @@
});
</div>
<p>
- <span data-if="isSingular(L)">The length is <var>L</var> <var>UNIT_TEXT</var>.</span><span data-else="">The length is <var>L</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, L)</var>.</span>
- <span data-if="isSingular(W)">The width is <var>W</var> <var>UNIT_TEXT</var>.</span><span data-else="">The width is <var>W</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, W)</var>.</span>
- <span>Thus the
- area is <code><var>L</var>\times<var>W</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.</span>
+ <span data-if="isSingular(L)">
+ The length is <var>L</var> <var>UNIT_TEXT</var>.
+ </span><span data-else="">
+ The length is <var>L</var> <var>plural_form(UNIT_TEXT, L)
+ </var>.</span>
+ <span data-if="isSingular(W)">
+ The width is <var>W</var> <var>UNIT_TEXT</var>.
+ </span><span data-else="">
+ The width is <var>W</var> <var>plural_form(UNIT_TEXT, W)</var>.
+ </span>
+ <span>
+ Thus the area is
+ <code><var>L</var>\times<var>W</var></code>
+ square <var>plural_form(UNIT_TEXT, L * W)</var>.
+ </span>
</p>
</div>
<div>
@@ -148,7 +168,7 @@
</code></p>
<p>
We can also count <var>L * W</var>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, L * W)</var>.
</p>
<div class="graphie" data-update="area">
_(L * W).times(function(n) {
@@ -201,7 +221,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>SHAPE.area</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -217,7 +237,7 @@
</div>
<p>
The area is <code><var>SHAPE.area</var></code> square
- <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ <var>plural_form(UNIT_TEXT, SHAPE.area)</var>.
</p>
</div>
</div>
View
26 exercises/area_of_parallelograms.html
@@ -74,11 +74,21 @@
<div class="exercise">
<div class="vars" data-ensure="Math.abs(SH) &lt;= B">
<var id="UNIT,UNIT_TEXT">randFromArray([
- ["in", "inch"],
- ["ft", "foot"],
- ["m", "meter"],
- ["cm", "centimeter"],
- ["", "unit"]
+ ["in", new Plural(function(num) {
+ return $.ngettext("inch", "inches", num);
+ })],
+ ["ft", new Plural(function(num) {
+ return $.ngettext("foot", "feet", num);
+ })],
+ ["m", new Plural(function(num) {
+ return $.ngettext("meter", "meters", num);
+ })],
+ ["cm", new Plural(function(num) {
+ return $.ngettext("centimeter", "centimeters", num);
+ })],
+ ["", new Plural(function(num) {
+ return $.ngettext("unit", "units", num);
+ })]
])</var>
<var id="B">randRange(1, 8)</var>
@@ -96,7 +106,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>K</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -107,7 +117,9 @@
graph.p.drawHeight();
</div>
<div>
- <p>By moving a slice of the parallelogram, we can see that its area is equal to that of a rectangle with the same base and height.</p>
+ <p>By moving a slice of the parallelogram, we can see
+ that its area is equal to that of a rectangle with the
+ same base and height.</p>
<div class="graphie" data-update="parallelogram">
graph.p.sliceHint();
graph.p.animHint();
View
62 exercises/area_of_squares_and_rectangles.html
@@ -9,11 +9,21 @@
<div class="exercise">
<div class="vars">
<var id="UNIT,UNIT_TEXT">randFromArray([
- ["in", "inch"],
- ["ft", "foot"],
- ["m", "meter"],
- ["cm", "centimeter"],
- ["", "unit"]
+ ["in", new Plural(function(num) {
+ return $.ngettext("inch", "inches", num);
+ })],
+ ["ft", new Plural(function(num) {
+ return $.ngettext("foot", "feet", num);
+ })],
+ ["m", new Plural(function(num) {
+ return $.ngettext("meter", "meters", num);
+ })],
+ ["cm", new Plural(function(num) {
+ return $.ngettext("centimeter", "centimeters", num);
+ })],
+ ["", new Plural(function(num) {
+ return $.ngettext("unit", "units", num);
+ })]
])</var>
</div>
<div class="problems">
@@ -27,12 +37,12 @@
<var>UNIT_TEXT</var> long. What is its area?
</span><span data-else="" data-unwrap="">
One side of a square is <code><var>S</var></code>
- <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var> long. What is its area?
+ <var>plural_form(UNIT_TEXT, S)</var> long. What is its area?
</span></p>
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>S * S</var></span> square
- <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -63,12 +73,12 @@
The length is <var>S</var> <var>UNIT_TEXT</var> and
the width is <var>S</var> <var>UNIT_TEXT</var>, so the
area is <code><var>S</var>\times<var>S</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p><p data-else="">
- The length is <var>S</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var> and
- the width is <var>S</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var>, so the
+ The length is <var>S</var> <var>plural_form(UNIT_TEXT, S)</var> and
+ the width is <var>S</var> <var>plural_form(UNIT_TEXT, S)</var>, so the
area is <code><var>S</var>\times<var>S</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p>
</div>
<div>
@@ -78,7 +88,7 @@
</code></p>
<p>
We can also count <var>S * S</var>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, S * S)</var>.
</p>
<div class="graphie" data-update="area">
_(S * S).times(function(n) {
@@ -98,12 +108,12 @@
<p class="question">
The area of a square is <code><var>S * S</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>. How long is each side?
+ square <var>plural_form(UNIT_TEXT, S * S)</var>. How long is each side?
</p>
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>S</var></span>
- <var>plural(UNIT_TEXT)</var>
+ <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -146,7 +156,7 @@
</p><p data-else="">
The sides of a square are all the same length, so each
side must be <code><var>S</var></code>
- <var>AMBIGUOUS_PLURAL(UNIT_TEXT, S)</var> long.
+ <var>plural_form(UNIT_TEXT, S)</var> long.
</p>
</div>
</div>
@@ -162,18 +172,18 @@
<span data-if="isSingular(L)">A rectangle is
<code><var>L</var></code> <var>UNIT_TEXT</var>
long.</span><span data-else="">A rectangle is
- <code><var>L</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, L)</var>
+ <code><var>L</var></code> <var>plural_form(UNIT_TEXT, L)</var>
long.</span>
<span data-if="isSingular(W)">The rectangle is also
<code><var>W</var></code> <var>UNIT_TEXT</var>
wide. What is its area?</span><span data-else="">The rectangle is also
- <code><var>W</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, W)</var>
+ <code><var>W</var></code> <var>plural_form(UNIT_TEXT, W)</var>
wide. What is its area?</span>
</p>
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>L * W</var></span> square
- <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -203,11 +213,19 @@
});
</div>
<p>
- <span data-if="isSingular(L)">The length is <var>L</var> <var>UNIT_TEXT</var>.</span><span data-else="">The length is <var>L</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, L)</var>.</span>
- <span data-if="isSingular(W)">The width is <var>W</var> <var>UNIT_TEXT</var>.</span><span data-else="">The width is <var>W</var> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, W)</var>.</span>
+ <span data-if="isSingular(L)">
+ The length is <var>L</var> <var>UNIT_TEXT</var>.
+ </span><span data-else="">
+ The length is <var>L</var> <var>plural_form(UNIT_TEXT, L)</var>.
+ </span>
+ <span data-if="isSingular(W)">
+ The width is <var>W</var> <var>UNIT_TEXT</var>.
+ </span><span data-else="">
+ The width is <var>W</var> <var>plural_form(UNIT_TEXT, W)</var>.
+ </span>
<span>Thus the
area is <code><var>L</var>\times<var>W</var></code>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.</span>
+ square <var>plural_form(UNIT_TEXT, L * W)</var>.</span>
</p>
</div>
<div>
@@ -217,7 +235,7 @@
</code></p>
<p>
We can also count <var>L * W</var>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>.
+ square <var>plural_form(UNIT_TEXT, L * W)</var>.
</p>
<div class="graphie" data-update="area">
_(L * W).times(function(n) {
View
38 exercises/area_of_triangles_1.html
@@ -9,11 +9,21 @@
<div class="exercise">
<div class="vars">
<var id="UNIT,UNIT_TEXT">randFromArray([
- ["in", "inch"],
- ["ft", "foot"],
- ["m", "meter"],
- ["cm", "centimeter"],
- ["", "unit"]
+ ["in", new Plural(function(num) {
+ return $.ngettext("inch", "inches", num);
+ })],
+ ["ft", new Plural(function(num) {
+ return $.ngettext("foot", "feet", num);
+ })],
+ ["m", new Plural(function(num) {
+ return $.ngettext("meter", "meters", num);
+ })],
+ ["cm", new Plural(function(num) {
+ return $.ngettext("centimeter", "centimeters", num);
+ })],
+ ["", new Plural(function(num) {
+ return $.ngettext("unit", "units", num);
+ })]
])</var>
</div>
<div class="problems">
@@ -45,7 +55,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>(B * H) / 2</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -67,10 +77,10 @@
<p>
<span data-if="isSingular(B)">The base of the triangle is
<code><var>B</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The base of the triangle is
- <code><var>B</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, B)</var>.</span>
+ <code><var>B</var></code> <var>plural_form(UNIT_TEXT, B)</var>.</span>
<span data-if="isSingular(H)">The height of the triangle is
<code><var>H</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The height of the triangle is
- <code><var>H</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, H)</var>.</span>
+ <code><var>H</var></code> <var>plural_form(UNIT_TEXT, H)</var>.</span>
<span>Thus the area of the
<em>rectangle</em> shown above is <code><var>B</var>
\times <var>H</var></code>.</span>
@@ -123,7 +133,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>(B * H) / 2</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -155,10 +165,10 @@
<p>
<span data-if="isSingular(B)">The base of the triangle is
<code><var>B</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The base of the triangle is
- <code><var>B</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, B)</var>.</span>
+ <code><var>B</var></code> <var>plural_form(UNIT_TEXT, B)</var>.</span>
<span data-if="isSingular(H)">The height of the triangle is
<code><var>H</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The height of the triangle is
- <code><var>H</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, H)</var>.</span>
+ <code><var>H</var></code> <var>plural_form(UNIT_TEXT, H)</var>.</span>
<span>Thus the area of the
<em>rectangle</em> shown above is <code><var>B</var>
\times <var>H</var></code>.</span>
@@ -267,7 +277,7 @@
<div class="solution" data-type="multiple">
<span class="sol" data-forms="integer"><var>(B * H) / 2</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -280,10 +290,10 @@
<p>
<span data-if="isSingular(B)">The base of the triangle is
<code><var>B</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The base of the triangle is
- <code><var>B</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, B)</var>.</span>
+ <code><var>B</var></code> <var>plural_form(UNIT_TEXT, B)</var>.</span>
<span data-if="isSingular(H)">The height of the triangle is
<code><var>H</var></code> <var>UNIT_TEXT</var>.</span><span data-else="">The height of the triangle is
- <code><var>H</var></code> <var>AMBIGUOUS_PLURAL(UNIT_TEXT, H)</var>.</span>
+ <code><var>H</var></code> <var>plural_form(UNIT_TEXT, H)</var>.</span>
</p>
<p><code>
\text{<var>$._("area")</var>} = \frac{1}{2} \times <var>B</var> \times
View
30 exercises/areas_of_trapezoids_rhombi_and_kites.html
@@ -9,11 +9,21 @@
<div class="exercise">
<div class="vars">
<var id="UNIT,UNIT_TEXT">randFromArray([
- ["in", "inch"],
- ["ft", "foot"],
- ["m", "meter"],
- ["cm", "centimeter"],
- ["", "unit"]
+ ["in", new Plural(function(num) {
+ return $.ngettext("inch", "inches", num);
+ })],
+ ["ft", new Plural(function(num) {
+ return $.ngettext("foot", "feet", num);
+ })],
+ ["m", new Plural(function(num) {
+ return $.ngettext("meter", "meters", num);
+ })],
+ ["cm", new Plural(function(num) {
+ return $.ngettext("centimeter", "centimeters", num);
+ })],
+ ["", new Plural(function(num) {
+ return $.ngettext("unit", "units", num);
+ })]
])</var>
</div>
@@ -58,7 +68,7 @@
<div class="solution" data-type="multiple">
<span class="sol"><var>K</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -190,7 +200,7 @@
<div class="solution" data-type="multiple">
<span class="sol"><var>K</var></span>
- square <var>AMBIGUOUS_PLURAL(UNIT_TEXT)</var>
+ square <var>plural_form(UNIT_TEXT)</var>
</div>
<div class="hints">
@@ -204,7 +214,11 @@
[<a href="#" class="show-subhint" data-subhint="area-kite">Show me why</a>]
</p>
<div class="subhint" id="area-kite">
- <p>The <span data-if="ORIENT === 'h'">horizontal</span><span data-else="">vertical</span> diagonal in the center splits the kite into two congruent triangles.</p>
+ <p data-if="ORIENT === 'h'">
+ The horizontal diagonal in the center splits the kite into two congruent triangles.
+ </p><p data-else>
+ The vertical diagonal in the center splits the kite into two congruent triangles.
+ </p>
<div class="graphie" data-update="figure">
var showSubHint = function() {
graph.subhint.show();
View
8 exercises/arithmetic_word_problems_1.html
@@ -284,9 +284,9 @@
The sum is <code><var>NUM2</var> + <var>NUM1</var></code> <var>plural_form(exercise(1), TOTAL)</var>.
</p>
<p data-if="isMale(1)">
- He did <code><var>NUM2</var> + <var>NUM1</var> = <var>TOTAL</var></code> <var>plural_form(exercise(1))</var>.
+ He did <code><var>NUM2</var> + <var>NUM1</var> = <var>TOTAL</var></code> <var>plural_form(exercise(1), TOTAL)</var>.
</p><p data-else="">
- She did <code><var>NUM2</var> + <var>NUM1</var> = <var>TOTAL</var></code> <var>plural_form(exercise(1))</var>.
+ She did <code><var>NUM2</var> + <var>NUM1</var> = <var>TOTAL</var></code> <var>plural_form(exercise(1), TOTAL)</var>.
</p>
</div>
@@ -307,10 +307,10 @@
<p class="question"><span data-if="isSingular(2)" data-unwrap="">
How many <var>exercise(1)</var> did <var>person(2)</var> do?
</span><span data-else="" data-unwrap="">
- How many <var>plural_form(exercise(1), 2)</var> did <var>person(2)</var> do?
+ How many <var>plural_form(exercise(1))</var> did <var>person(2)</var> do?
</span></p>
<div class="solution" data-type="multiple">
- <span class="sol" data-forms="integer" style="padding-right: 5px"><var>NUM2</var></span> <var>plural(exercise(1), 2)</var>
+ <span class="sol" data-forms="integer" style="padding-right: 5px"><var>NUM2</var></span> <var>plural(exercise(1))</var>
</div>
<div class="hints">
<p data-if="isSingular(TOTAL)">
View
14 exercises/arithmetic_word_problems_2.html
@@ -124,7 +124,7 @@
and the number of days that <var>person(1)</var> went <var>biking(1)</var>.
</p>
<p>
- The product is <code><var>NUM1</var>\text{ <var>$._("%(distance_unit)s per day", {distance_unit: plural_form(distance( 1 ))})</var>} \times <var>NUM2</var>\text{ <var>$._("days")</var>}</code>.
+ The product is <code><var>NUM1</var>\text{ <var>$._("%(distance_unit)s per day", {distance_unit: plural_form(distance( 1, NUM1 ))})</var>} \times <var>NUM2</var>\text{ <var>$._("days")</var>}</code>.
</p>
<p>
<code><var>NUM1</var>\text{ <var>$._("%(distance_unit)s per day", {distance_unit: plural( distance( 1 ) )})</var>} \times <var>NUM2</var>\text{ <var>$._("days")</var>}= <var>TOTAL</var>\text{ <var>plural( distance(1) )</var>}</code>
@@ -162,12 +162,12 @@
by the number of days that <var>person(1)</var> went <var>biking(1)</var>.
</p>
<p>
- We are looking for the quotient, which is <code><var>TOTAL</var>\text{ <var>plural_form(distance( 1 ))</var>} \div <var>NUM2</var>\text{ <var>$._("days")</var>}</code>.
+ We are looking for the quotient, which is <code><var>TOTAL</var>\text{ <var>plural_form(distance( 1, TOTAL ))</var>} \div <var>NUM2</var>\text{ <var>$._("days")</var>}</code>.
</p>
<p>
<code><var>TOTAL</var>\text{ <var>plural( distance( 1 ) )</var>} \div <var>NUM2</var>\text{ <var>$._("days")</var>} = <var>NUM1</var> \text{ <var>$._("%(distance_unit)s per day", {distance_unit: plural( distance(1) )})</var>}</code>
</p>
- <p><var>person( 1 )</var> <var>biked( 1 )</var> <var>NUM1</var> <var>plural_form(distance(1))</var> each day.</p>
+ <p><var>person( 1 )</var> <var>biked( 1 )</var> <var>NUM1</var> <var>plural_form(distance(1), NUM)</var> each day.</p>
</div>
</div>
@@ -268,10 +268,10 @@
divided by the number of rows.
</p>
<p>
- The result, called the quotient, is <code><var>TOTAL</var>\text{ <var>plural_form(crop( 1 ))</var>} \div <var>NUM1</var>\text{ <var>$._("rows of %(crop)s", {crop: plural_form(crop( 1 ))})</var>}</code>.
+ The result, called the quotient, is <code><var>TOTAL</var>\text{ <var>plural_form(crop( 1 ), TOTAL)</var>} \div <var>NUM1</var>\text{ <var>$._("rows of %(crop)s", {crop: plural_form(crop( 1 ))})</var>}</code>.
</p>
<p>
- <code><var>TOTAL</var>\text{ <var>plural( crop( 1 ) )</var>} \div <var>NUM1</var>\text{ <var>$._("rows of %(crop)s", {plural__crop__1____: plural( crop( 1 ) )})</var>} = <var>NUM2</var>\text{ <var>$._("%(crop)s per row", {crop: plural( crop(1) )})</var>}</code>
+ <code><var>TOTAL</var>\text{ <var>plural( crop( 1 ) )</var>} \div <var>NUM1</var>\text{ <var>$._("rows of %(crop)s", {crop: plural( crop( 1 ) )})</var>} = <var>NUM2</var>\text{ <var>$._("%(crop)s per row", {crop: plural( crop(1) )})</var>}</code>
</p>
</div>
</div>
@@ -303,10 +303,10 @@
divided by the number of <var>plural_form(crop(1))</var> in each row.
</p>
<p>
- The result, called the quotient, is <code><var>TOTAL</var>\text{ <var>plural_form(crop( 1 ))</var>} \div <var>NUM1</var>\text{ <var>$._("%(crop)s per row", {crop: plural_form(crop(1))})</var>}</code>.
+ The result, called the quotient, is <code><var>TOTAL</var>\text{ <var>plural_form(crop( 1 ), TOTAL)</var>} \div <var>NUM1</var>\text{ <var>$._("%(crop)s per row", {crop: plural_form(crop(1))})</var>}</code>.
</p>
<p>
- <code><var>TOTAL</var>\text{ <var>plural( crop( 1 ) )</var>} \div <var>NUM1</var>\text{ <var>$._("%(crop)s per row", {crop: plural( crop(1) )})</var>} = <var>NUM2</var>\text{ <var>plural( 'row' )</var>}</code>
+ <code><var>TOTAL</var>\text{ <var>plural( crop( 1 ) )</var>} \div <var>NUM1</var>\text{ <var>$._("%(crop)s per row", {crop: plural( crop(1) )})</var>} = <var>NUM2</var>\text{ rows}</code>
</p>
</div>
</div>
View
8 exercises/average_word_problems.html
@@ -24,7 +24,7 @@
</div>
<div class="question">
- <p data-if="isMale(1)">In his <var>course(1)</var> class, <var>person(1)</var> took <var>LENGTH</var> <var>plural_form(exam(1))</var>. His scores were <var>toSentence(SCORES)</var>.</p><p data-else="">In her <var>course(1)</var> class, <var>person(1)</var> took <var>LENGTH</var> <var>plural_form(exam(1))</var>. Her scores were <var>toSentence(SCORES)</var>.</p>
+ <p data-if="isMale(1)">In his <var>course(1)</var> class, <var>person(1)</var> took <var>LENGTH</var> <var>plural_form(exam(1), LENGTH)</var>. His scores were <var>toSentence(SCORES)</var>.</p><p data-else="">In her <var>course(1)</var> class, <var>person(1)</var> took <var>LENGTH</var> <var>plural_form(exam(1), LENGTH)</var>. Her scores were <var>toSentence(SCORES)</var>.</p>
<p data-if="isMale(1)">What was his average score on the <var>plural_form(exam(1))</var>?</p><p data-else="">What was her average score on the <var>plural_form(exam(1))</var>?</p>
</div>
@@ -45,7 +45,7 @@
</div>
<div class="question">
- <p data-if="isMale(1)">On the first <var>COUNT</var> <var>plural_form(exam(1))</var> of his <var>course(1)</var> class, <var>person(1)</var> got an average score of <var>OLD_AVG</var>.</p><p data-else="">On the first <var>COUNT</var> <var>plural_form(exam(1))</var> of her <var>course(1)</var> class, <var>person(1)</var> got an average score of <var>OLD_AVG</var>.</p>
+ <p data-if="isMale(1)">On the first <var>COUNT</var> <var>plural_form(exam(1), COUNT)</var> of his <var>course(1)</var> class, <var>person(1)</var> got an average score of <var>OLD_AVG</var>.</p><p data-else="">On the first <var>COUNT</var> <var>plural_form(exam(1), COUNT)</var> of her <var>course(1)</var> class, <var>person(1)</var> got an average score of <var>OLD_AVG</var>.</p>
<p data-if="isMale(1)">What does he need on the next <var>exam(1)</var> to have an overall average of <var>NEW_AVG</var>?</p><p data-else="">What does she need on the next <var>exam(1)</var> to have an overall average of <var>NEW_AVG</var>?</p>
</div>
@@ -68,9 +68,9 @@
</div>
<div class="question">
- <p data-if="isMale(1)"><var>person(1)</var> has taken <var>COUNT</var> <var>plural_form(exam(1))</var> and his average score so far is <var>OLD_AVG</var>.</p><p data-else=""><var>person(1)</var> has taken <var>COUNT</var> <var>plural_form(exam(1))</var> and her average score so far is <var>OLD_AVG</var>.</p>
+ <p data-if="isMale(1)"><var>person(1)</var> has taken <var>COUNT</var> <var>plural_form(exam(1), COUNT)</var> and his average score so far is <var>OLD_AVG</var>.</p><p data-else=""><var>person(1)</var> has taken <var>COUNT</var> <var>plural_form(exam(1), COUNT)</var> and her average score so far is <var>OLD_AVG</var>.</p>
- <p data-if="isMale(1)">If he gets 100, a perfect score, on the remaining <var>REMAINING</var> <var>plural_form(exam(1))</var>, what will his new average be?</p><p data-else="">If she gets 100, a perfect score, on the remaining <var>REMAINING</var> <var>plural_form(exam(1))</var>, what will her new average be?</p>
+ <p data-if="isMale(1)">If he gets 100, a perfect score, on the remaining <var>REMAINING</var> <var>plural_form(exam(1), REMAINING)</var>, what will his new average be?</p><p data-else="">If she gets 100, a perfect score, on the remaining <var>REMAINING</var> <var>plural_form(exam(1), REMAINING)</var>, what will her new average be?</p>
</div>
<div class="solution"><var>NEW_AVG</var></div>
View
7 exercises/axis_of_symmetry.html
@@ -11,7 +11,8 @@
<var id="SYM">randRange( 0, 1 )</var>
<var id="SIDES">randRange( 3, 8 )</var>
<var id="SIDE">randRange( 0, SIDES - 1 )</var>
- <var id="ANSWER">SYM ? "Yes" : "No"</var>
+ <var id="YES,NO">[$._("Yes"), $._("No")]</var>
+ <var id="ANSWER">SYM ? YES : NO</var>
</div>
<div class="problems">
@@ -31,8 +32,8 @@
</div>
<div class="solution"><var>ANSWER</var></div>
<ul class="choices" data-category="true">
- <li>Yes</li>
- <li>No</li>
+ <li><var>YES</var></li>
+ <li><var>NO</var></li>
</ul>
<div class="hints">
<p>Does the blue line split the shape into two parts which look like reflections of each other?</p>
View
10 exercises/coin_flip_sequences.html
@@ -88,9 +88,9 @@
return (SEQUENCE.match(RegExp("(?=" + result + ")", "g")) || []).length
})</var>
<var id="CHOICES">[
- 'Fair coin',
- 'Unfair coin',
- 'Human guesses'
+ $._("Fair coin"),
+ $._("Unfair coin"),
+ $._("Human guesses")
]</var>
</div>
@@ -143,7 +143,7 @@
range: [[0, 16], [0, 6]],
scale: [31, 54]
});
- label([8, 6], "Two-flip streaks", "below", false).css({
+ label([8, 6], $._("Two-flip streaks"), "below", false).css({
"font-size": "16px",
"color": "#444444"
});
@@ -175,7 +175,7 @@
range: [[0, 16], [0, 6]],
scale: [31, 54]
});
- label([8, 6], "Three-flip streaks", "below", false).css({
+ label([8, 6], $._("Three-flip streaks"), "below", false).css({
"font-size": "16px",
"color": "#444444"
});
View
51 exercises/combinations_1.html
@@ -9,50 +9,69 @@
<div class="exercise">
<div class="problems">
<div id="packing">
- <div class="vars" data-ensure="NUM_THINGS&gt;NUM_TAKEN">
- <var id="THING">randFromArray(["shirts", "tigers", "books", "Fabergé eggs", "socks", "action figures"])</var>
+ <div class="vars" data-ensure="NUM_THINGS &gt; NUM_TAKEN">
+ <var id="THING">randFromArray([
+ new Plural(function(num) {
+ return $.ngettext("shirt", "shirts", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("tiger", "tigers", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("book", "books", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("Fabergé egg", "Fabergé eggs", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("sock", "socks", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("action figure", "action figures", num);
+ })
+ ])</var>
<var id="NUM_THINGS">randRange(5,9)</var>
<var id="NUM_TAKEN">randRange(3,5)</var>
<var id="ANSWER">factorial(NUM_THINGS) / (factorial(NUM_THINGS-NUM_TAKEN) * factorial(NUM_TAKEN))</var>
</div>
<p class="problem" data-if="isMale(1)">
- <var>person(1)</var> is packing his bags for his vacation. He has
- <code><var>NUM_THINGS</var></code> unique <var>THING</var>, but only <code><var>NUM_TAKEN</var></code> fit in his bag.
+ <var>person(1)</var> is packing his bags for his vacation. He has
+ <code><var>NUM_THINGS</var></code> unique <var>plural_form(THING, NUM_THINGS)</var>, but only <code><var>NUM_TAKEN</var></code> fit in his bag.
</p><p class="problem" data-else="">
<var>person(1)</var> is packing her bags for her vacation. She has
- <code><var>NUM_THINGS</var></code> unique <var>THING</var>, but only <code><var>NUM_TAKEN</var></code> fit in her bag.
+ <code><var>NUM_THINGS</var></code> unique <var>plural_form(THING, NUM_THINGS)</var>, but only <code><var>NUM_TAKEN</var></code> fit in her bag.
</p>
- <p class="question" data-if="isMale(1)">How many different groups of <code><var>NUM_TAKEN</var></code> <var>THING</var> can he take?</p><p class="question" data-else="">How many different groups of <code><var>NUM_TAKEN</var></code> <var>THING</var> can she take?</p>
+ <p class="question" data-if="isMale(1)">How many different groups of <code><var>NUM_TAKEN</var></code> <var>plural_form(THING, NUM_TAKEN)</var> can he take?</p><p class="question" data-else="">How many different groups of <code><var>NUM_TAKEN</var></code> <var>plural_form(THING, NUM_TAKEN)</var> can she take?</p>
<p class="solution" data-forms="integer"><var>ANSWER</var></p>
<div class="hints">
<p data-if="isMale(1)">
- <var>person(1)</var> has <code><var>NUM_TAKEN</var></code> spaces for his <var>THING</var>,
+ <var>person(1)</var> has <code><var>NUM_TAKEN</var></code> spaces for his <var>plural_form(THING)</var>,
so let's fill them one by one.
At first, <var>person(1)</var> has <code><var>NUM_THINGS</var></code> choices for what to put in the first space.
</p><p data-else="">
- <var>person(1)</var> has <code><var>NUM_TAKEN</var></code> spaces for her <var>THING</var>,
+ <var>person(1)</var> has <code><var>NUM_TAKEN</var></code> spaces for her <var>plural_form(THING)</var>,
so let's fill them one by one.
At first, <var>person(1)</var> has <code><var>NUM_THINGS</var></code> choices for what to put in the first space.
</p>
<p data-if="isMale(1)">
- For the second space, he only has <code><var>NUM_THINGS-1</var></code> <var>THING</var> left, so there are only
+ For the second space, he only has <code><var>NUM_THINGS-1</var></code> <var>plural_form(THING, NUM_THINGS-1)</var> left, so there are only
<code><var>NUM_THINGS-1</var></code> choices
of what to put in the second space. So far, it seems like there are <code><var>NUM_THINGS</var> \cdot <var>NUM_THINGS-1</var> =
<var>NUM_THINGS * (NUM_THINGS-1)</var></code> different unique choices <var>person(1)</var> could have made to fill the first two
spaces in his bag. But that's not quite right.
</p><p data-else="">
- For the second space, she only has <code><var>NUM_THINGS-1</var></code> <var>THING</var> left, so there are only
+ For the second space, she only has <code><var>NUM_THINGS-1</var></code> <var>plural_form(THING, NUM_THINGS-1)</var> left, so there are only
<code><var>NUM_THINGS-1</var></code> choices
of what to put in the second space. So far, it seems like there are <code><var>NUM_THINGS</var> \cdot <var>NUM_THINGS-1</var> =
<var>NUM_THINGS * (NUM_THINGS-1)</var></code> different unique choices <var>person(1)</var> could have made to fill the first two
spaces in her bag. But that's not quite right.
</p>
<p data-if="isMale(1)">
- Why? Because if he picked <var>THING.substring(0,THING.length-1)</var> number 3, then
- <var>THING.substring(0,THING.length-1)</var> number 1, that's the same situation as picking number 1 and then number 3. They both end up in the same bag.
+ Why? Because if he picked <var>THING</var> number 3, then
+ <var>THING</var> number 1, that's the same situation as picking number 1 and then number 3. They both end up in the same bag.
</p><p data-else="">
- Why? Because if she picked <var>THING.substring(0,THING.length-1)</var> number 3, then
- <var>THING.substring(0,THING.length-1)</var> number 1, that's the same situation as picking number 1 and then number 3. They both end up in the same bag.
+ Why? Because if she picked <var>THING</var> number 3, then
+ <var>THING</var> number 1, that's the same situation as picking number 1 and then number 3. They both end up in the same bag.
</p>
<p data-if="isMale(1)">
So, if <var>person(1)</var> keeps filling the spaces in his bag, making <code><var>_.map(_.range(NUM_TAKEN), function(l){ return (NUM_THINGS - l);}).join("\\cdot")</var> = \dfrac{<var>NUM_THINGS</var>!}{(<var>NUM_THINGS</var>-<var>NUM_TAKEN</var>)!} = <var> factorial(NUM_THINGS)/factorial(NUM_THINGS-NUM_TAKEN)</var></code> decisions altogether, we've overcounted a bunch of groups.
@@ -67,15 +86,15 @@
</p>
<p>
There are <code><var>NUM_TAKEN</var>! = <var>factorial(NUM_TAKEN)</var></code> ways of ordering <code><var>NUM_TAKEN</var></code>
- things, so we've counted each group of <code><var>NUM_TAKEN</var></code> <var>THING</var>
+ things, so we've counted each group of <code><var>NUM_TAKEN</var></code> <var>plural_form(THING, NUM_TAKEN)</var>
<code><var>factorial(NUM_TAKEN)</var></code> times.
</p>
<p>
So, we have to divide the number of ways we could have filled the bag in order by number of times we've overcounted our groups.
</p>
<p>
<code> \dfrac{<var>NUM_THINGS</var>!}{(<var>NUM_THINGS</var> - <var>NUM_TAKEN</var>)!} \cdot \dfrac{1}{<var>NUM_TAKEN</var>!}</code> is the number
- of groups of <var>THING</var> <var>person(1)</var> can bring.
+ of groups of <var>plural_form(THING)</var> <var>person(1)</var> can bring.
<br>
Another way to write this is <code> \binom{<var>NUM_THINGS</var>}{<var>NUM_TAKEN</var>} </code>,
or <code><var>NUM_THINGS</var></code> choose <code><var>NUM_TAKEN</var></code>, which is <code><var>ANSWER</var></code>.
View
28 exercises/comparing_improper_fractions_and_mixed_numbers.html
@@ -31,8 +31,6 @@
<var id="LCM">getLCM( M_DENOM_REDUCED, I_DENOM )</var>
<var id="F1">LCM / M_DENOM_REDUCED</var>
<var id="F2">LCM / I_DENOM</var>
- <var id="BECOMES_1">F1 === 1 ? "remains as" : "becomes"</var>
- <var id="BECOMES_2">F2 === 1 ? "remains as" : "becomes"</var>
<var id="M_AS_I">M_DENOM_REDUCED*WHOLE+M_NUM_REDUCED</var>
<var id="SOLUTION">(function() {
@@ -72,8 +70,16 @@
<p>Their smallest common denominator is the LCM of <var>M_DENOM_REDUCED</var> and <var>I_DENOM</var>.</p>
<p><code>\lcm(<var>M_DENOM_REDUCED</var>, <var>I_DENOM</var>) = <var>LCM</var></code></p>
<div>
- <p>The first fraction <var>BECOMES_1</var> <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.</p>
- <p>The second fraction <var>BECOMES_2</var> <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.</p>
+ <p data-if="F1 === 1">
+ The first fraction remains as <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.
+ </p><p data-else>
+ The first fraction becomes <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.
+ </p>
+ <p data-if="F2 === 1">
+ The second fraction remains as <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.
+ </p><p data-else>
+ The second fraction becomes <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.
+ </p>
</div>
</div>
<p>We see that <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>} <var>SOLUTION</var> \dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.</p>
@@ -101,8 +107,6 @@
<var id="LCM">getLCM( M_DENOM_REDUCED, I_DENOM )</var>
<var id="F1">LCM / M_DENOM_REDUCED</var>
<var id="F2">LCM / I_DENOM</var>
- <var id="BECOMES_1">F1 === 1 ? "remains as" : "becomes"</var>
- <var id="BECOMES_2">F2 === 1 ? "remains as" : "becomes"</var>
<var id="M_AS_I">M_DENOM_REDUCED*WHOLE+M_NUM_REDUCED</var>
<var id="SOLUTION">(function() {
@@ -142,8 +146,16 @@
<p>Their smallest common denominator is the LCM of <var>M_DENOM_REDUCED</var> and <var>I_DENOM</var>.</p>
<p><code>\lcm(<var>M_DENOM_REDUCED</var>, <var>I_DENOM</var>) = <var>LCM</var></code></p>
<div>
- <p>The first fraction <var>BECOMES_1</var> <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.</p>
- <p>The second fraction <var>BECOMES_2</var> <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.</p>
+ <p data-if="F1 === 1">
+ The first fraction remains as <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.
+ </p><p data-else>
+ The first fraction becomes <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>}</code>.
+ </p>
+ <p data-if="F2 === 1">
+ The second fraction remains as <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.
+ </p><p data-else>
+ The second fraction becomes <code>\dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.
+ </p>
</div>
</div>
<p>We see that <code>\dfrac{<var>M_AS_I * F1</var>}{<var>LCM</var>} <var>SOLUTION</var> \dfrac{<var>I_NUM * F2</var>}{<var>LCM</var>}</code>.</p>
View
6 exercises/completing_the_square_2.html
@@ -25,7 +25,7 @@
<div class="set-sol"><var>X1</var></div>
<div class="set-sol"><var>X2</var></div>
<div class="input-format">
- <p><code>x = {}</code><span class="entry short32"></span><code>\quad \text{<var>$._("or")</var>} \quad x = {}</code><span class="entry short32"></span></p>
+ <p><code>x = {}</code><span class="entry short32"></span><code>\text{ <var>$._("or")</var> } x = {}</code><span class="entry short32"></span></p>
</div>
<p class="example">integers, like <code>6</code></p>
<p class="example"><em>simplified proper</em> fractions, like <code>3/5</code></p>
@@ -86,10 +86,10 @@
<div data-if="B !== 0">
<p>Isolate <code>x</code> to find the solution(s).</p>
<p data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"><code>x = <var>decimalFraction( -B / 2, 1, 1 )</var>\pm<var>decimalFraction( sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></code></p>
- <p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ or } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
+ <p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ <var>$._("or")</var> } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
</div>
<div data-else="">
- <p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ or } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
+ <p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ <var>$._("or")</var> } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
</div>
</div>
</div>
View
35 exercises/congruency_postulates.html
@@ -29,12 +29,12 @@
( ( TYPE !== 'SSA' ) || ( (TRIANGLE.niceSideLengths[0] + 1) &lt; TRIANGLE.niceSideLengths[1] &amp;&amp; abs(ANGLES[0] - 90) &gt; 10 ) )">
<var id="TYPE">randFromArray([ "SSS", "SAS", "SAA", "ASA", "SSA", "SSA", "AAA" ])</var>
<var id="NAME">{
- "SSS": "Side-Side-Side",
- "SAS": "Side-Angle-Side",
- "SAA": "Side-Angle-Angle",
- "ASA": "Angle-Side-Angle",
- "SSA": "Side-Side-Angle",
- "AAA": "Angle-Angle-Angle"
+ "SSS": $._("Side-Side-Side"),
+ "SAS": $._("Side-Angle-Side"),
+ "SAA": $._("Side-Angle-Angle"),
+ "ASA": $._("Angle-Side-Angle"),
+ "SSA": $._("Side-Side-Angle"),
+ "AAA": $._("Angle-Angle-Angle")
}[ TYPE ]
</var>
<var id="ANGLES">randomTriangleAngles.triangle()</var>
@@ -45,12 +45,19 @@
<var id="ROTATION">randRange( 0, 360 )</var>
</div>
<p class="problem">
- <strong>Is <em><var>NAME</var></em> a triangle congruency postulate?</strong><br>
- Answer the question by clicking and dragging the points below to see how many different triangles you can construct.<br>
- If you can only construct congruent triangles, then the <var>NAME</var> postulate is true. The <var>NAME</var> postulate is not true if you can construct two or more different triangles using the given information.
+ <strong>Is <em><var>NAME</var></em> a triangle congruency
+ postulate?</strong><br>
+ Answer the question by clicking and dragging the points
+ below to see how many different triangles you can
+ construct.<br>
+ If you can only construct congruent triangles, then the
+ <var>NAME</var> postulate is true. The <var>NAME</var>
+ postulate is not true if you can construct two or more
+ different triangles using the given information.
</p>
<div class="question">
- <em>Your triangle can be anywhere. There is no need to line up the two triangles.</em>
+ <em>Your triangle can be anywhere. There is no need to line
+ up the two triangles.</em>
<div class="graphie" id="triangles">
init({
range: [ [ -6.2, 6.2 ], [ -5.9, 6.5 ] ]
@@ -74,10 +81,10 @@
<div class="instruction">
<ul>
<li><label><input name="solution" type="radio" value="Yes"><span class="value">
- Yes And I've constructed a congruent triangle, and this is the <strong>ONLY</strong> triangle I can construct with these conditions.
+ Yes &mdash; And I've constructed a congruent triangle, and this is the <strong>ONLY</strong> triangle I can construct with these conditions.
</span></label></li>
<li><label><input name="solution" type="radio" value="No"><span class="value">
- No And I've proven it by constructing an incongruent triangle (a counterexample).
+ No &mdash; And I've proven it by constructing an incongruent triangle (a counterexample).
</span></label></li>
</ul>
</div>
@@ -109,9 +116,9 @@
} else if ( guess[0] !== ANSWER ) {
return false;
} else if ( !isTriangle ) {
- return "Your answer is almost correct, but you haven't constructed a triangle.";
+ return $._("Your answer is almost correct, but you havent constructed a triangle.");
} else if ( ANSWER === "No" &amp;&amp; isCongruent ) {
- return "Your answer is almost correct, but the two triangles are congruent. Prove your answer by trying to construct an incongruent triangle.";
+ return $._("Your answer is almost correct, but the two triangles are congruent. Prove your answer by trying to construct an incongruent triangle.");
} else {
return true;
}
View
11 exercises/congruent_segments.html
@@ -14,8 +14,9 @@
<div class="problems">
<div>
<div class="vars">
- <var id="SOLUTION">random() &lt; 0.5 ? "Yes" : "No"</var>
- <div data-ensure="( SOLUTION === 'Yes' &amp;&amp; POINTS[ 1 ] - POINTS[ 0 ] === POINTS[ 3 ] - POINTS[ 2 ] ) || ( SOLUTION === 'No' &amp;&amp; POINTS[ 1 ] - POINTS[ 0 ] !== POINTS[ 3 ] - POINTS[ 2 ] )">
+ <var id="YES,NO">[$._("Yes"), $._("No")]</var>
+ <var id="SOLUTION">random() &lt; 0.5 ? YES : NO</var>
+ <div data-ensure="( SOLUTION === YES &amp;&amp; POINTS[ 1 ] - POINTS[ 0 ] === POINTS[ 3 ] - POINTS[ 2 ] ) || ( SOLUTION === NO &amp;&amp; POINTS[ 1 ] - POINTS[ 0 ] !== POINTS[ 3 ] - POINTS[ 2 ] )">
<var id="POINTS">sortNumbers( randRangeUnique( -5, 5, 4 ) )</var>
</div>
<var id="COLORS">[ BLUE, GREEN, PINK, ORANGE ]</var>
@@ -51,8 +52,8 @@
</div>
<div class="solution"><var>SOLUTION</var></div>
<ul class="choices" data-category="true">
- <li>Yes</li>
- <li>No</li>
+ <li><var>YES</var></li>
+ <li><var>NO</var></li>
</ul>
<div class="hints">
@@ -72,7 +73,7 @@
<span class="lcol"><code>AB = <var>POINTS[ 1 ] - POINTS[ 0 ]</var></code></span>
<span class="rcol"><code>CD = <var>POINTS[ 3 ] - POINTS[ 2 ]</var></code></span>
</p>
- <div data-if="SOLUTION === 'Yes'" data-unwrap="">
+ <div data-if="SOLUTION === YES" data-unwrap="">
<p><code>AB = CD</code></p>
<p class="final_answer">Yes, <code>\overline{AB}</code> and <code>\overline{CD}</code> are congruent.</p>
</div>
View
15 exercises/congruent_triangles_1.html
@@ -10,10 +10,11 @@
<div class="vars">
<var id="MAIN">randomTriangleAngles.triangle()</var>
<var id="MAIN_SIZE">5 + random() * 2</var>
- <var id="IS_B">randRange( 0, 1 ) === 1 ? true : false</var>
+ <var id="IS_B">randRange( 0, 1 ) === 1</var>
<var id="B">IS_B ? MAIN : randomTriangleAngles.triangle()</var>
<var id="B_SIZE">IS_B ? MAIN_SIZE : 2 + random() * 2</var>
- <var id="ANSWER">IS_B ? "Yes" : "No"</var>
+ <var id="CHOICES">[$._("Yes"), $._("No"), $._("There is not enough information to say")]</var>
+ <var id="ANSWER">IS_B ? 0 : 1</var>
<var id="A_ANGLES">[ 0, 1, 2 ]</var>
<var id="B_ANGLES">A_ANGLES</var>
@@ -69,11 +70,11 @@
TR_B.drawLabels();
</div>
</div>
- <div class="solution"><var>ANSWER</var></div>
+ <div class="solution"><var>CHOICES[ANSWER]</var></div>
<ul class="choices" data-category="true">
- <li>Yes</li>
- <li>No</li>
- <li>There is not enough information to say</li>
+ <li data-each="CHOICES as choice">
+ <var>choice</var>
+ </li>
</ul>
<div class="problems">
@@ -129,7 +130,7 @@
<div class="vars">
<var id="A_ANGLES">[ 0, 1, 2 ]</var>
<var id="A_SIDES">[ ]</var>
- <var id="ANSWER">IS_B ? "There is not enough information to say" : "No"</var>
+ <var id="ANSWER">IS_B ? 2 : 1</var>
</div>
<div class="hints" data-apply="appendContents">
<p>In this problem we know all three triangle angles.</p>
View
65 exercises/counting_1.html
@@ -13,24 +13,71 @@
<var id="START">randRange( 20, 50 )</var>
<var id="ANSWER">randRange( 20, 40 )</var>
<var id="END">START + ANSWER - 1</var>
- <var id="DO, DID, PROBLEMS">spin( "{do,did,problems|read,read,{pages|papers|articles}}" ).split( "," )</var>
+ <var id="DO_BOOL">randRange(0, 1) === 0</var>
+ <var id="PROBLEMS">DO_BOOL ? $._("problems") : randFromArray([$._("pages"), $._("papers"), $._("articles")]) </var>
+ <var id="RAND_1">randRange(0, 1) === 0</var>
+ <var id="RAND_2">randRange(0, 1) === 0</var>
</div>
- <p class="spin">
- <var>person( 1 )</var> {had to <var>DO</var>|was assigned} <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework {{last {week|night}}|tonight}.
+ <p>
+ <span data-if="DO_BOOL">
+ <span data-if="RAND_1 && RAND_2">
+ <var>person( 1 )</var> had to do <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework last week.
+ </span><span data-if="RAND_1 && !RAND_2">
+ <var>person( 1 )</var> had to do <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework tonight.
+ </span><span data-if="!RAND_1 && RAND_2">
+ <var>person( 1 )</var> was assigned <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework last week.
+ </span><span data-if="!RAND_1 && !RAND_2">
+ <var>person( 1 )</var> was assigned <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework tonight.
+ </span>
+ </span><span data-else>
+ <span data-if="RAND_1 && RAND_2">
+ <var>person( 1 )</var> had to read <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework last week.
+ </span><span data-if="RAND_1 && !RAND_2">
+ <var>person( 1 )</var> had to read <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework tonight.
+ </span><span data-if="!RAND_1 && RAND_2">
+ <var>person( 1 )</var> was assigned <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework last week.
+ </span><span data-if="!RAND_1 && !RAND_2">
+ <var>person( 1 )</var> was assigned <var>PROBLEMS</var> <var>START</var> through <var>END</var> for homework tonight.
+ </span>
+ </span>
</p>
- <p class="question spin" data-if="isMale(1)">
- If <var>person( 1 )</var> <var>DID</var> all of the <var>PROBLEMS</var> he was assigned, how many <var>PROBLEMS</var> did he <var>DO</var>?
- </p><p class="question spin" data-else="">
- If <var>person( 1 )</var> <var>DID</var> all of the <var>PROBLEMS</var> she was assigned, how many <var>PROBLEMS</var> did she <var>DO</var>?
+ <p class="question" data-if="isMale(1)">
+ <span data-if="DO_BOOL">
+ If <var>person( 1 )</var> did all of the <var>PROBLEMS</var> he was assigned, how many <var>PROBLEMS</var> did he do?
+ </span><span data-else>
+ If <var>person( 1 )</var> read all of the <var>PROBLEMS</var> he was assigned, how many <var>PROBLEMS</var> did he read?
+ </span>
+ </p><p class="question" data-else="">
+ <span data-if="DO_BOOL">
+ If <var>person( 1 )</var> did all of the <var>PROBLEMS</var> she was assigned, how many <var>PROBLEMS</var> did she do?
+ </span><span data-else>
+ If <var>person( 1 )</var> read all of the <var>PROBLEMS</var> she was assigned, how many <var>PROBLEMS</var> did she read?
+ </span>
</p>
<div class="solution" data-type="multiple">
<p><span class="sol" data-forms="integer"><var>ANSWER</var></span> <var>PROBLEMS</var></p>
</div>
<div class="hints">
<p>Instead of counting <var>PROBLEMS</var> <var>START</var> through <var>END</var>, we can subtract <var>START - 1</var> from each number so we instead consider <var>PROBLEMS</var> 1 through <var>ANSWER</var>.</p>
- <p>We see that <var>person( 1 )</var> <var>DID</var> <var>ANSWER</var> <var>PROBLEMS</var>.</p>
- <p data-if="isMale(1)">Notice that he <var>DID</var> <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.</p><p data-else="">Notice that she <var>DID</var> <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.</p>
+ <p data-if="DO_BOOL">
+ We see that <var>person( 1 )</var> did <var>ANSWER</var> <var>PROBLEMS</var>.
+ </p><p data-else>
+ We see that <var>person( 1 )</var> read <var>ANSWER</var> <var>PROBLEMS</var>.
+ </p>
+ <p data-if="isMale(1)">
+ <span data-if="DO_BOOL">
+ Notice that he did <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.
+ </span><span data-else>
+ Notice that he read <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.
+ </span>
+ </p><p data-else="">
+ <span data-if="DO_BOOL">
+ Notice that she did <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.
+ </span><span data-else>
+ Notice that she read <var>ANSWER</var> and not <var>ANSWER - 1</var> <var>PROBLEMS</var>.
+ </span>
+ </p>
</div>
</div>
<div id="slices">
View
111 exercises/creating_bar_charts_1.html
@@ -22,22 +22,53 @@
<div class="problems">
<div>
<div class="vars">
- <var id="SUBJECT">randFromArray([ "animal", "color", "fruit", "course" ])</var>
- <var id="CATEGORIES">$.map( _.range(5), function( n ) { return ( KhanUtil[ SUBJECT ] )( n + 1 ); } )</var>
- <var id="DATA">$.map( _.range(5), function() { return randRange( 0, 10 ); } )</var>
- <var id="TOTAL">sum( DATA )</var>
- <var id="RESPONDENT">randFromArray([ "student", "teacher", "person" ])</var>
+ <var id="SUBJECT,SUBJECT_FUNC">randFromArray([
+ [new Plural(function(num) {
+ return $.ngettext("animal", "animals", num);
+ }), KhanUtil.animal],
+ [new Plural(function(num) {
+ return $.ngettext("color", "colors", num);
+ }), KhanUtil.color],
+ [new Plural(function(num) {
+ return $.ngettext("fruit", "fruits", num);
+ }), KhanUtil.fruit],
+ [new Plural(function(num) {
+ return $.ngettext("course", "courses", num);
+ }), KhanUtil.course]
+ ])</var>
+ <var id="CATEGORIES">_.times(5, function(n) { return SUBJECT_FUNC(n + 1); } )</var>
+ <var id="DATA">_.times(5, function() { return randRange(0, 10); } )</var>
+ <var id="TOTAL">sum(DATA)</var>
+ <var id="RESPONDENT">randFromArray([
+ new Plural(function(num) {
+ return $.ngettext("student", "students", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("teacher", "teachers", num);
+ }),
+ new Plural(function(num) {
+ return $.ngettext("person", "people", num);
+ })
+ ])</var>
+ <var id="SHUFFLED">shuffle(_.zip(DATA, CATEGORIES))</var>
</div>
- <p data-if="isSingular(TOTAL)"><code><var>TOTAL</var></code> <var>RESPONDENT</var> were asked about their favorite <var>SUBJECT</var>.
- <var>toSentence( shuffle( $.map( DATA, function( num, i ) {
- return "&lt;code&gt;" + num + "&lt;/code&gt; " + plural( RESPONDENT, num ) + " said " + CATEGORIES[ i ];
- }) ) )</var>.</p><p data-else=""><code><var>TOTAL</var></code> <var>AMBIGUOUS_PLURAL(RESPONDENT, TOTAL)</var> were asked about their favorite <var>SUBJECT</var>.
- <var>toSentence( shuffle( $.map( DATA, function( num, i ) {
- return "&lt;code&gt;" + num + "&lt;/code&gt; " + plural( RESPONDENT, num ) + " said " + CATEGORIES[ i ];
- }) ) )</var>.</p>
+ <p>
+ <span data-if="isSingular(TOTAL)">
+ <code><var>TOTAL</var></code> <var>RESPONDENT</var> was asked about their favorite <var>SUBJECT</var>.
+ </span><span data-else="">
+ <code><var>TOTAL</var></code> <var>plural_form(RESPONDENT, TOTAL)</var> were asked about their favorite <var>SUBJECT</var>.
+ </span>
+ <span data-each="SHUFFLED as DATA">
+ <span data-if="isSingular(DATA[0])">
+ <code><var>DATA[0]</var></code> <var>RESPONDENT</var> said <var>DATA[1]</var>.
+ </span><span data-else>
+ <code><var>DATA[0]</var></code> <var>plural_form(RESPONDENT, DATA[0])</var> said <var>DATA[1]</var>.
+ </span>
+ </span>
+ </p>
- <p class="question">Create a bar chart showing everyone's favorite <var>AMBIGUOUS_PLURAL(SUBJECT)</var>:</p>
+ <p class="question">Create a bar chart showing everyone's favorite <var>plural_form(SUBJECT)</var>:</p>
<div class="problem">
@@ -87,17 +118,30 @@
line( [ 0, 0 ], [ 0, 10 ] );
});
- label( [ 8, -0.8 ], "&lt;b&gt;" + SUBJECT + "&lt;/b&gt;", "below", false ).css( "text-transform", "capitalize" );
- $( label( [ -1.5, 5 ], "&lt;b&gt;Number of " + plural( RESPONDENT ) + "&lt;/b&gt;", "center", false ) ).addClass( "rotate" );
- label( [ 8, 10.5 ], "&lt;b&gt;Favorite " + SUBJECT + "s&lt;/b&gt;", "above", false );
+ label([8, -0.8],
+ SUBJECT + "",
+ "below", false)
+ .css("text-transform", "capitalize")
+ .css("font-weight", "bold");
+ label([-1.5, 5],
+ $._("Number of %(respondent)s", { respondent: plural_form(RESPONDENT) }),
+ "center", false)
+ .css("font-weight", "bold")
+ .addClass("rotate");
+ label([8, 10.5],
+ $._("Favorite %(subject)s", { subject: plural_form(SUBJECT) }),
+ "above", false)
+ .css("font-weight", "bold");
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Create a bar chart by dragging the top of each bar up and down.
</div>
- <div class="guess">$.map( new Array( 5 ), function( val, n ) { return graph.lines[ n ].coordA[1]; })</div>
+ <div class="guess">
+ _.times(5, function(n) { return graph.lines[ n ].coordA[1]; })
+ </div>
<div class="validator-function">
if ( _.isEqual( guess, [ 0.5, 0.5, 0.5, 0.5, 0.5 ] ) ) {
return "";
@@ -119,27 +163,24 @@
<div class="hints">
<div data-each="DATA as INDEX, NUM">
- <p data-if="isSingular(NUM)">
- <code><var>NUM</var></code> <var>RESPONDENT</var> said their
- 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
- <code><var>NUM</var></code> on the left side of the chart.
+ <p>
+ <span data-if="isSingular(NUM)">
+ <code><var>NUM</var></code> <var>RESPONDENT</var> said their
+ favorite <var>SUBJECT</var> was <var>CATEGORIES[ INDEX ]</var>.
+ </span><span data-else="">
+ <code><var>NUM</var></code> <var>plural_form(RESPONDENT, NUM)</var> said their
+ favorite <var>SUBJECT</var> was <var>CATEGORIES[ INDEX ]</var>.
</span>
- <span data-else="">
- So there should be no bar above "<span style="text-transform: capitalize"><var>CATEGORIES[ INDEX ]</var></span>". Drag the top of the bar all
- the way to the bottom to get rid of the bar.
- </span>
- </p><p data-else="">
- <code><var>NUM</var></code> <var>AMBIGUOUS_PLURAL(RESPONDENT, NUM)</var> said their
- 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
+ So the top of the bar for
+ "<span style="text-transform: capitalize"><var>CATEGORIES[ INDEX ]</var></span>"
+ should line up with the number
<code><var>NUM</var></code> on the left side of the chart.
- </span>
- <span data-else="">
- So there should be no bar above "<span style="text-transform: capitalize"><var>CATEGORIES[ INDEX ]</var></span>". Drag the top of the bar all
- the way to the bottom to get rid of the bar.
+ </span><span data-else>
+ So there should be no bar above
+ "<span style="text-transform: capitalize"><var>CATEGORIES[ INDEX ]</var></span>".
+ Drag the top of the bar all the way to the bottom to get
+ rid of the bar.
</span>
</p>
<div class="graphie" data-if="NUM > 0" data-update="barchart">
View
90 exercises/defined_and_undefined_matrix_operations.html
@@ -9,7 +9,8 @@
<div class="exercise">
<div class="vars" data-ensure="!(DIM_1 === 1 &amp;&amp; DIM_2 === 1) &amp;&amp; !(DIM_3 === 1 &amp;&amp; DIM_4 === 1) &amp;&amp; (PRETTY_MAT_1_ID !== PRETTY_MAT_2_ID)">
- <var id="ANSWER">DEFINED ? "Yes" : "No"</var>
+ <var id="YES,NO">[$._("Yes"), $._("No")]</var>
+ <var id="ANSWER">DEFINED ? YES : NO</var>
<var id="MAT_1">makeMatrix(randRange(-2, 4, DIM_1, DIM_2))</var>
<var id="MAT_2">makeMatrix(randRange(-2, 4, DIM_3, DIM_4))</var>
@@ -40,8 +41,8 @@
<p class="solution"><var>ANSWER</var></p>
<ul class="choices" data-category="true">
- <li>Yes</li>
- <li>No</li>
+ <li><var>YES</var></li>
+ <li><var>NO</var></li>
</ul>
<div class="problems">
@@ -59,47 +60,75 @@
<div class="hints">
<div>
- <p>
- In order for <span data-if="OPERATION === '+'">addition</span><span data-else="">subtraction</span> of two matrices to be defined, the matrices must have the same dimensions.
- </p>
- <p>
- If <code><var>PRETTY_MAT_1_ID</var></code> is of dimension <code>(\blue m \times \red n)</code> and <code><var>PRETTY_MAT_2_ID</var></code> is of dimension <code>(\blue p \times \red q)</code>, then:
- </p>
+ <span data-if="OPERATION === '+'">
+ <p>
+ In order for addition of two matrices to be
+ defined, the matrices must have the same
+ dimensions.
+ </p>
+ <p>
+ If <code><var>PRETTY_MAT_1_ID</var></code> is of
+ dimension <code>(\blue m \times \red n)</code> and
+ <code><var>PRETTY_MAT_2_ID</var></code> is of
+ dimension <code>(\blue p \times \red q)</code>,
+ then for their sum to be defined:
+ </p>
+ </span><span data-else>
+ <p>
+ In order for subtraction of two matrices to be
+ defined, the matrices must have the same
+ dimensions.
+ </p>
+ <p>
+ If <code><var>PRETTY_MAT_1_ID</var></code> is of
+ dimension <code>(\blue m \times \red n)</code> and
+ <code><var>PRETTY_MAT_2_ID</var></code> is of
+ dimension <code>(\blue p \times \red q)</code>,
+ then for their difference to be defined:
+ </p>
+ </span>
<p>
1. <code>\blue m</code> (number of rows in <code><var>PRETTY_MAT_1_ID</var></code>) must equal <code>\blue p</code> (number of rows in <code><var>PRETTY_MAT_2_ID</var></code>) and
</p>
<p>
2. <code>\red n</code> (number of columns in <code><var>PRETTY_MAT_1_ID</var></code>) must equal <code>\red q</code> (number of columns in <code><var>PRETTY_MAT_2_ID</var></code>)
</p>
- <p>
- for their <span data-if="OPERATION === '+'">sum</span><span data-else="">difference</span> to be defined.
- </p>
</div>
<div class="qhint">
<p>
Do <code><var>PRETTY_MAT_1_ID</var></code> and <code><var>PRETTY_MAT_2_ID</var></code> have the same number of rows?
</p>
- <span class="qhint-answer"><var>DIM_1 === DIM_3 ? "Yes" : "No"</var></span>
+ <span class="qhint-answer"><var>DIM_1 === DIM_3 ? YES : NO</var></span>
<p class="qhint-input">
- <input class="simple-button" type="button" value="Yes">
- <input class="simple-button" type="button" value="No">
+ <a href="javascript:void(0)" class="qhint-button simple-button"><var>YES</var></a>
+ <a href="javascript:void(0)" class="qhint-button simple-button"><var>NO</var></a>
</p>
</div>
<div class="qhint">
<p>
Do <code><var>PRETTY_MAT_1_ID</var></code> and <code><var>PRETTY_MAT_2_ID</var></code> have the same number of columns?
</p>
- <span class="qhint-answer"><var>DIM_2 === DIM_4 ? "Yes" : "No"</var></span>
+ <span class="qhint-answer"><var>DIM_2 === DIM_4 ? YES : NO</var></span>
<p class="qhint-input">
- <input class="simple-button" type="button" value="Yes">
- <input class="simple-button" type="button" value="No">
+ <a href="javascript:void(0)" class="qhint-button simple-button"><var>YES</var></a>
+ <a href="javascript:void(0)" class="qhint-button simple-button"><var>NO</var></a>
</p>
</div>
<div>
- <p>
- Since <code><var>PRETTY_MAT_1_ID</var></code> has <span data-if="DEFINED">the same</span><span data-else="">different</span> dimensions <code>(<var>DIM_1 + "\\times" + DIM_2</var>)</code> <span data-if="DEFINED">as</span><span data-else="">from</span> <code><var>PRETTY_MAT_2_ID</var></code> <code>(<var>DIM_3 + "\\times" + DIM_4</var>)</code>,
- </p><p>
- <code><var>PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID</var></code> is <span data-if="!DEFINED">not</span> defined.
+ <p data-if="DEFINED">
+ Since <code><var>PRETTY_MAT_1_ID</var></code> has
+ the same dimensions
+ <code>(<var>DIM_1 + "\\times" + DIM_2</var>)</code> as
+ <code><var>PRETTY_MAT_2_ID</var></code> <code>(<var>DIM_3 + "\\times" + DIM_4</var>)</code>,
+ <code><var>PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID</var></code>
+ is defined.
+ </p><p data-else>
+ Since <code><var>PRETTY_MAT_1_ID</var></code> has
+ different dimensions
+ <code>(<var>DIM_1 + "\\times" + DIM_2</var>)</code> from
+ <code><var>PRETTY_MAT_2_ID</var></code> <code>(<var>DIM_3 + "\\times" + DIM_4</var>)</code>,
+ <code><var>PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID</var></code>
+ is not defined.
</p>
</div>
</div>
@@ -148,8 +177,21 @@
<input type="submit" value="Check">
</p>
</div>
- <div>
- Since <code><var>PRETTY_MAT_1_ID</var></code> has <span data-if="DEFINED">the same</span><span data-else="">a different</span> number of columns (<var>DIM_2</var>) <span data-if="DEFINED">as</span><span data-else="">than</span> <code><var>PRETTY_MAT_2_ID</var></code> has rows (<var>DIM_3</var>), <code><var>PRETTY_MAT_1_ID + PRETTY_MAT_2_ID</var></code> is <span data-if="!DEFINED">not</span> defined.
+ <div data-if="DEFINED">
+ Since <code><var>PRETTY_MAT_1_ID</var></code> has the same
+ number of columns (<var>DIM_2</var>) as
+ <code><var>PRETTY_MAT_2_ID</var></code> has rows
+ (<var>DIM_3</var>),
+ <code><var>PRETTY_MAT_1_ID + PRETTY_MAT_2_ID</var></code>
+ is defined.
+ </div><div data-else>
+ Since <code><var>PRETTY_MAT_1_ID</var></code> has a
+ different number of columns
+ (<var>DIM_2</var>) than
+ <code><var>PRETTY_MAT_2_ID</var></code> has rows
+ (<var>DIM_3</var>),
+ <code><var>PRETTY_MAT_1_ID + PRETTY_MAT_2_ID</var></code>
+ is not defined.
</div>
</div>
</div>
View
31 exercises/dice_probability.html
@@ -233,30 +233,47 @@
</div>
<span class="question" id="question-statement" data-apply="append">
- For a given roll, what is the probability that the dice are
<span data-if="X !== Y">
- <code><var>X</var></code> and <code><var>Y</var></code><span data-if="X < 5"> in any order</span></span><span data-else="">
- both equal to <code><var>X</var></code></span>?
+ <span data-if="X < 5">
+ For a given roll, what is the probability that the dice are
+ <code><var>X</var></code> and <code><var>Y</var></code>
+ in any order?
+ </span><span data-else>
+ For a given roll, what is the probability that the dice are
+ <code><var>X</var></code> and <code><var>Y</var></code>?
+ </span>
+ </span><span data-else>
+ For a given roll, what is the probability that the dice are
+ both equal to <code><var>X</var></code>?
+ </span>
</span>
</div>
<div id="d1-is-even-d2-is-x" data-type="template">
<div class="vars" data-apply="prependVars">
<var id="EVEN">rand(2)</var>
- <var id="EVEN_OR_ODD">EVEN ? "odd" : "even"</var>
<var id="PRED">function(x, y) {
return x % 2 === EVEN &amp;&amp; y === Y;
}</var>
</div>
<span class="question" id="question-statement" data-apply="append">
- For a given roll, what is the probability that the black die is
- <var>EVEN_OR_ODD</var> and the white die is <code><var>Y</var></code>?
+ <span data-if="EVEN">
+ For a given roll, what is the probability that the black
+ die is even and the white die is <code><var>Y</var></code>?
+ </span><span data-else>
+ For a given roll, what is the probability that the black
+ die is even and the white die is <code><var>Y</var></code>?
+ </span>
</span>
<div class="hints" data-apply="prependContents">
- <p>How many <var>EVEN_OR_ODD</var> numbers are there on the black die?</p>
+ <p data-if="EVEN">
+ How many even numbers are there on the black die?
+ </p><p data-else>
+ How many odd numbers are there on the black die?
+ </p>
</div>
</div>
View
21 exercises/direct_and_inverse_variation.html
@@ -11,6 +11,11 @@
<var id="VARIABLE_NAMES">[["x", "y"], ["a", "b"], ["m", "n"]]</var>
<var id="V1, V2">randFromArray(VARIABLE_NAMES)</var>
+ <!-- Used in the string interpolations below -->
+ <var id="V1V2">{
+ v1: "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt;",
+ v2: "&lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt;",
+ }</var>
<var id="MULTIPLIER_IS_FRACTIONAL">rand(2)</var>
<var id="MULTIPLIER_VALUE">randRange(2, 9)</var>
@@ -23,10 +28,10 @@
<div id="direct-variation">
<div class="vars">
<var id="STATEMENT">randFromArray([
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; is directly proportional to &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt;",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; and &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt; vary directly",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; varies directly with &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt;",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; and &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt; are in direct variation"
+ $._("%(v1)s is directly proportional to %(v2)s", V1V2),
+ $._("%(v1)s and %(v2)s vary directly", V1V2),
+ $._("%(v1)s varies directly with %(v2)s", V1V2),
+ $._("%(v1)s and %(v2)s are in direct variation", V1V2)
])</var>
</div>
@@ -95,10 +100,10 @@
<div id="inverse-variation">
<div class="vars">
<var id="STATEMENT">randFromArray([
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; is inversely proportional to &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt;",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; and &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt; vary inversely",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; varies inversely with &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt;",
- "&lt;code&gt;&lt;var&gt;V1&lt;/var&gt;&lt;/code&gt; and &lt;code&gt;&lt;var&gt;V2&lt;/var&gt;&lt;/code&gt; are in inverse variation"
+ $._("%(v1)s is inversely proportional to %(v2)s", V1V2),
+ $._("%(v1)s and %(v2)s vary inversely", V1V2),
+ $._("%(v1)s varies inversely with %(v2)s", V1V2),
+ $._("%(v1)s and %(v2)s are in inverse variation", V1V2)
])</var>
</div>
View
22 exercises/exploring_mean_and_median.html
@@ -75,8 +75,9 @@
[0, 0.7], [0.05, 0.7], [0, 0.6],
[-0.05, 0.7], [0, 0.7], [0, 1.0]
]);
- // I18N: "mean" in the "average" sense
- graph.meanLabel = label([0, 1.3], "\\text{" + $._("mean") + "}",
+ graph.meanLabel = label([0, 1.3],
+ // I18N: "mean" as in "average"
+ "\\text{" + $._("mean") + "}",
"above", { color: BLUE });
graph.meanValueLabel = label([0, 0.8], "0",
"above", { color: BLUE });
@@ -86,7 +87,8 @@
[0, -1.1], [0.05, -1.1], [0, -1],
[-0.05, -1.1], [0, -1.1], [0, -1.4]
]);
- graph.medianLabel = label([0, -1.7], "\\text{" + $._("median") + "}",
+ graph.medianLabel = label([0, -1.7],
+ "\\text{" + $._("median") + "}",
"below", { color: GREEN });
graph.medianValueLabel = label([0, -1.2], "0",
"below", { color: GREEN });
@@ -164,9 +166,10 @@
<span class="hint_green">
<code><var>MEDIAN</var></code></span>.
</span><br>
- <input onclick="javascript:
- KhanUtil.showMedianExample();
- " type="button" value="Show me an example">
+ <a class="simple-button" onclick="javascript:
+ KhanUtil.showMedianExample();">
+ Show me an example
+ </a>
</p>
<p>
As long as there are as many points to the left and to
@@ -182,9 +185,10 @@
<code><var>MEAN</var></code></span> and the median is
<span class="hint_green">
<code><var>MEDIAN</var></code></span>.
- <input onclick="javascript:
- KhanUtil.showMeanExample();
- " type="button" value="Show me an example">
+ <a class="simple-button" onclick="javascript:
+ KhanUtil.showMeanExample();">
+ Show me an example
+ </a>
</p>
</div>
</div>
View
11 exercises/exponents_1.html
@@ -59,8 +59,6 @@
<var id="VALS">pickIntegerBasePositiveExponent()</var>
<var id="BASE">VALS.base</var>
<var id="EXP">VALS.exp</var>
-
- <var id="NEG_ONE_HINT">BASE &gt; 0 ? "" : ( isEven( EXP ) ? "even" : "odd" )</var>
</div>
<p class="question"><code>\Large <var>negParens( BASE )</var>^{<var>EXP</var>}</code></p>
@@ -79,8 +77,13 @@
</div>
<div data-else-if="BASE === -1" data-unwrap="">
- <p><var>Cardinal( BASE )</var> to any <var>NEG_ONE_HINT</var> power equals... ?</p>
- <p><var>Cardinal( BASE )</var> to any <var>NEG_ONE_HINT</var> power equals <span class="hint_blue"><var>cardinal( round( pow( BASE, EXP ) ) )</var></span>.</p>
+ <span data-if="isEven(EXP)" data-unwrap>
+ <p><var>Cardinal( BASE )</var> to any even power equals... ?</p>
+ <p><var>Cardinal( BASE )</var> to any even power equals <span class="hint_blue"><var>cardinal( round( pow( BASE, EXP ) ) )</var></span>.</p>
+ </span><span data-else data-unwrap>
+ <p><var>Cardinal( BASE )</var> to any odd power equals... ?</p>
+ <p><var>Cardinal( BASE )</var> to any odd power equals <span class="hint_blue"><var>cardinal( round( pow( BASE, EXP ) ) )</var></span>.</p>
+ </span>
</div>