From c4a6355563371676140a4defa99cecf236d67743 Mon Sep 17 00:00:00 2001 From: Iwan Date: Thu, 9 Jan 2020 14:06:14 +0000 Subject: [PATCH] Add statuses and minor corrections (#286) --- lib/lang/cy.js | 16 +++++++++++++--- test_cases/cy.json | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/lib/lang/cy.js b/lib/lang/cy.js index fd467b8e..38fb42fb 100644 --- a/lib/lang/cy.js +++ b/lib/lang/cy.js @@ -48,7 +48,7 @@ module.exports = { "later-today-morning": "yn hwyrach bore yma", "today-afternoon": "y prynhawn yma", "later-today-afternoon": "yn hwyrach prynhawn yma", - "today-evening": "fin nos heno", + "today-evening": "gyda’r hwyr heno", "later-today-evening": "yn hwyrach fin nos heno", "today-night": "heno", "later-today-night": "yn hwyrach heno", @@ -58,7 +58,7 @@ module.exports = { "tomorrow-night": "nos yfory", "morning": "yn y bore", "afternoon": "yn y prynhawn", - "evening": "fin nos", + "evening": "gyda’r hwyr", "night": "dros nos", "today": "heddiw", "tomorrow": "yfory", @@ -89,8 +89,12 @@ module.exports = { return "llai na" + (/^(1|8|11|16)[\D\b]/.test(a) ? "g " : " ") + a; }, "and": function(a, b) { + // don't repeat 'yn y' + if (a.slice(0,5) === "yn y " && b.slice(0,5) === "yn y ") + return a + " a’r " + b.slice(5); // don't repeat 'ar' - if (a.slice(0,9) === "ar ddydd " && b.slice(0,9) === "ar ddydd ") b = b.slice(4); + if (a.slice(0,9) === "ar ddydd " && b.slice(0,9) === "ar ddydd ") + b = b.slice(4); return a // include comma if a list + (a.indexOf(",") !== -1 ? "," : "") @@ -141,4 +145,10 @@ module.exports = { str += "."; return str; }, + "next-hour-forecast-status": "Dydi rhagolygon yr awr nesa $1 oherwydd $2.", + "unavailable": "ddim ar gael", + "temporarily-unavailable": "ddim ar gael ar hyn o bryd", + "partially-unavailable": "ddim yn gyflawn", + "station-offline": "diffyg gwybodaeth o orsafoedd radar gerllaw", + "station-incomplete": "bylchau yn narpariaeth gorsafoedd radar gerllaw", }; diff --git a/test_cases/cy.json b/test_cases/cy.json index b14dcc84..f7bcff46 100644 --- a/test_cases/cy.json +++ b/test_cases/cy.json @@ -57,13 +57,13 @@ "medium-snow", ["and", "later-today-evening", "tomorrow-morning"]]], - "Glaw trwm hyd at hwyrach bore yma, gan gychwyn eto fin nos heno.": + "Glaw trwm hyd at hwyrach bore yma, gan gychwyn eto gyda’r hwyr heno.": ["sentence", ["until-starting-again", "heavy-rain", "later-today-morning", "today-evening"]], - "Cymylau trwchus yn cychwyn fin nos, gan barhau hyd at y nos.": + "Cymylau trwchus yn cychwyn gyda’r hwyr, gan barhau hyd at y nos.": ["sentence", ["starting-continuing-until", "heavy-clouds", "evening", @@ -158,5 +158,18 @@ ["through", "friday", "saturday"]], ["temperatures-peaking", ["fahrenheit", 100], - "monday"]]] + "monday"]]], + + "Glaw ysgafn yn bosib yn y bore a’r prynhawn.": + ["sentence", ["during", + "possible-light-rain", ["and", + "morning", "afternoon"]]], + + "Dydi rhagolygon yr awr nesa ddim ar gael ar hyn o bryd oherwydd diffyg gwybodaeth o orsafoedd radar gerllaw.": + ["sentence",["next-hour-forecast-status", "temporarily-unavailable", "station-offline"]], + "Dydi rhagolygon yr awr nesa ddim yn gyflawn oherwydd bylchau yn narpariaeth gorsafoedd radar gerllaw.": + ["sentence",["next-hour-forecast-status", "partially-unavailable", "station-incomplete"]], + "Dydi rhagolygon yr awr nesa ddim ar gael oherwydd diffyg gwybodaeth o orsafoedd radar gerllaw.": + ["sentence",["next-hour-forecast-status", "unavailable", "station-offline"]] + }