Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Add status messages in Cornish #290

Merged
8 commits merged into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions lib/lang/kw.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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",
Expand All @@ -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",
};
9 changes: 8 additions & 1 deletion test_cases/kw.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
}