diff --git a/lib/lang/kw.js b/lib/lang/kw.js index 5122c311..cbf7e25c 100644 --- a/lib/lang/kw.js +++ b/lib/lang/kw.js @@ -1,23 +1,23 @@ "use strict"; function in_the(period) { - if(period === "myttin" || period === "dohajydh" || period === "gorthugher" || period === "nos") { + if (period === "myttin" || period === "dohajydh" || period === "gorthugher" || period === "nos") { return " y'n " + period; } - if(period === "an dohajydh ma" || period === "an nos ma") { + if (period === "an dohajydh ma" || period === "an nos ma") { return " y'n " + period.slice(3); } - if("123456789".indexOf(period.charAt(0)) !== -1) { + if ("123456789".indexOf(period.charAt(0)) !== -1) { return " yn " + period; } return " " + period; } function until_the(period) { - if(period === "myttin" || period === "dohajydh" || period === "gorthugher" || period === "nos") { + if (period === "myttin" || period === "dohajydh" || period === "gorthugher" || period === "nos") { return " bys y'n " + period; } - if(period === "an dohajydh ma" || period === "an nos ma") { + if (period === "an dohajydh ma" || period === "an nos ma") { return " bys y'n " + period.slice(3); } return " bys yn " + period; @@ -102,7 +102,7 @@ module.exports = { "less-than": "le ages $1", "and": function(a, b) { let andy = a.indexOf(",") !== -1 ? ", ha" : " ha"; - if(b.charAt(0) === "a" || b.charAt(0) === "e" || b.charAt(0) === "i" || b.charAt(0) === "o" || b.charAt(0) === "u") { + if (b.charAt(0) === "a" || b.charAt(0) === "e" || b.charAt(0) === "i" || b.charAt(0) === "o" || b.charAt(0) === "u") { andy = andy + "g"; } @@ -144,7 +144,6 @@ module.exports = { }, "during": function(condition, period) { return condition + in_the(period); - // "$1 y\'n $2" }, "for-week": "$1 dres oll an seythun", "over-weekend": "$1 dres an bennseythun", @@ -169,9 +168,15 @@ module.exports = { str = str.charAt(0).toUpperCase() + str.slice(1); /* Add a period if there isn't already one. */ - if(str.charAt(str.length - 1) !== ".") + if (str.charAt(str.length - 1) !== ".") str += "."; return str; }, + "next-hour-forecast-status": "Darganow herwydh an our yw $1 drefen bos $2.", + "unavailable": "ankavadow", + "temporarily-unavailable": "ankavadow dres pols", + "partially-unavailable": "ankavadow yn rann", + "station-offline": "pub gorsav radar y'n ranndir dhywarlinen", + "station-incomplete": "aswaow y'n gorherans dhyworth gorsavow radar y'n ranndir", }; diff --git a/test_cases/kw.json b/test_cases/kw.json index ef4b8fc6..49682e1f 100644 --- a/test_cases/kw.json +++ b/test_cases/kw.json @@ -257,5 +257,12 @@ "Glaw pur skav ow talleth le ages 1 myn.": ["sentence", - ["starting-in", "very-light-rain", ["less-than", ["minutes", 1]]]] + ["starting-in", "very-light-rain", ["less-than", ["minutes", 1]]]], + + "Darganow herwydh an our yw ankavadow dres pols drefen bos pub gorsav radar y'n ranndir dhywarlinen.": + ["sentence",["next-hour-forecast-status", "temporarily-unavailable", "station-offline"]], + "Darganow herwydh an our yw ankavadow yn rann drefen bos aswaow y'n gorherans dhyworth gorsavow radar y'n ranndir.": + ["sentence",["next-hour-forecast-status", "partially-unavailable", "station-incomplete"]], + "Darganow herwydh an our yw ankavadow drefen bos pub gorsav radar y'n ranndir dhywarlinen.": + ["sentence",["next-hour-forecast-status", "unavailable", "station-offline"]] }