Skip to content

Commit

Permalink
Figured I'd forget all about snow the moment it turns nice.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason LaPorte committed Jul 26, 2013
1 parent 03a5ab1 commit f2f4fbd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,17 @@ number of arguments.)
* `"minutes"`/1
* `"fahrenheit"`/1
* `"celsius"`/1
* `"inches"`/1
* `"centimeters"`/1

#### Conjunctions

* `"and"`/2
* `"through"`/2
* `"with"`/2
* `"range"`/2
* `"parenthetical"`/2
* `"less-than"`/1

#### Clauses

Expand Down
7 changes: 6 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ This would be a lot cleaner.

---

I think I neglected the case for snow accumulation! Oops.
I think I neglected the tests for snow accumulation! Oops.

(parenthetical X (inches 2)) => "X (2 in.)"
(parenthetical X (centimeters 4)) => "X (4 cm.)"
(parenthetical X (inches (less-than 1))) => "X (under 1 in.)"
(parenthetical X (centimeters (range 6 10))) => "X (6-10 cm.)"
5 changes: 5 additions & 0 deletions lib/lang/english.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ module.exports = require("../template")({
"minutes": "$1 min.",
"fahrenheit": "$1\u00B0F",
"celsius": "$1\u00B0C",
"inches": "$1 in.",
"centimeters": "$1 cm.",
"less-than": "under $1",
"and": function(a, b) {
return join_with_shared_prefix(
a,
Expand All @@ -84,6 +87,8 @@ module.exports = require("../template")({
return join_with_shared_prefix(a, b, " through ");
},
"with": "$1, with $2",
"range": "$1\u2013$2",
"parenthetical": "$1 ($2)",
"for-hour": "$1 for the hour",
"starting-in": "$1 starting in $2",
"stopping-in": "$1 stopping in $2",
Expand Down
10 changes: 5 additions & 5 deletions test-cases/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,35 @@
"tomorrow-night"]]],


"No precipitation throughout the week, with temperatures peaking at 85°F tomorrow.":
"No precipitation throughout the week, with temperatures peaking at 85\u00B0F tomorrow.":
["sentence", ["with",
["for-week", "no-precipitation"],
["temperatures-peaking",
["fahrenheit", 85],
"tomorrow"]]],

"Mixed precipitation over the weekend, with temperatures rising to 32°C on Thursday.":
"Mixed precipitation over the weekend, with temperatures rising to 32\u00B0C on Thursday.":
["sentence", ["with",
["over-weekend", "mixed-precipitation"],
["temperatures-rising",
["celsius", 32],
"thursday"]]],

"Drizzle today, with temperatures bottoming out at 15°F on Friday.":
"Drizzle today, with temperatures bottoming out at 15\u00B0F on Friday.":
["sentence", ["with",
["during", "very-light-rain", "today"],
["temperatures-valleying",
["fahrenheit", 15],
"friday"]]],

"Light snow on Monday and Tuesday, with temperatures falling to 0°C on Sunday.":
"Light snow on Monday and Tuesday, with temperatures falling to 0\u00B0C on Sunday.":
["sentence", ["with",
["during", "light-snow", ["and", "monday", "tuesday"]],
["temperatures-falling",
["celsius", 0],
"sunday"]]],

"Precipitation on Wednesday through Saturday, with temperatures peaking at 100°F on Monday.":
"Precipitation on Wednesday through Saturday, with temperatures peaking at 100\u00B0F on Monday.":
["sentence", ["with",
["during",
"medium-precipitation",
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("translation", function() {

describe(name, function() {
var cases = JSON.parse(
fs.readFileSync(path.join(__dirname, "test-cases", lang))
fs.readFileSync(path.join(__dirname, "test-cases", lang), "utf8")
);

Object.keys(cases).forEach(function(summary) {
Expand Down

0 comments on commit f2f4fbd

Please sign in to comment.