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

Add Welsh translation #217

Merged
1 commit merged into from
Apr 2, 2019
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
144 changes: 144 additions & 0 deletions lib/lang/cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
"use strict";

module.exports = {
"clear": "clir",
"no-precipitation": "dim gwlybaniaeth",
"mixed-precipitation": "gwlybaniaeth cymysg",
"possible-very-light-precipitation": "gwlybaniaeth ysgafn yn bosib",
"very-light-precipitation": "gwlybaniaeth ysgafn",
"possible-light-precipitation": "gwlybaniaeth ysgafn yn bosib",
"light-precipitation": "gwlybaniaeth ysgafn",
"medium-precipitation": "gwlybaniaeth",
"heavy-precipitation": "gwlybaniaeth trwm",
"possible-very-light-rain": "glaw mân yn bosib",
"very-light-rain": "glaw mân",
"possible-light-rain": "glaw ysgafn yn bosib",
"light-rain": "glaw ysgafn",
"medium-rain": "glaw",
"heavy-rain": "glaw trwm",
"possible-very-light-sleet": "eirlaw ysgafn yn bosib",
"very-light-sleet": "eirlaw ysgafn",
"possible-light-sleet": "eirlaw ysgafn yn bosib",
"light-sleet": "eirlaw ysgafn",
"medium-sleet": "eirlaw",
"heavy-sleet": "eirlaw trwm",
"possible-very-light-snow": "eira ysgafn yn bosib",
"very-light-snow": "eira ysgafn",
"possible-light-snow": "eira ysgafn yn bosib",
"light-snow": "eira ysgafn",
"medium-snow": "eira",
"heavy-snow": "eira trwm",
"possible-thunderstorm": "mellt a tharannau yn bosib",
"thunderstorm": "mellt a tharannau",
"light-wind": "gwyntoedd ysgafn",
"medium-wind": "gwyntog",
"heavy-wind": "gwyntoedd cryfion",
"low-humidity": "sych",
"high-humidity": "clòs",
"fog": "niwlog",
"light-clouds": "rhannol gymylog",
"medium-clouds": "cymylog",
"heavy-clouds": "cymylau trwchus",
"today-morning": "y bore yma",
"later-today-morning": "yn hwyrach bore yma",
"today-afternoon": "y prynhawn yma",
"later-today-afternoon": "yn hwyrach prynhawn yma",
"today-evening": "fin nos heno",
"later-today-evening": "yn hwyrach fin nos heno",
"today-night": "heno",
"later-today-night": "yn hwyrach heno",
"tomorrow-morning": "bore yfory",
"tomorrow-afternoon": "prynhawn yfory",
"tomorrow-evening": "fin nos yfory",
"tomorrow-night": "nos yfory",
"morning": "yn y bore",
"afternoon": "yn y prynhawn",
"evening": "fin nos",
"night": "dros nos",
"today": "heddiw",
"tomorrow": "yfory",
"sunday": "ar ddydd Sul",
"monday": "ar ddydd Llun",
"tuesday": "ar ddydd Mawrth",
"wednesday": "ar ddydd Mercher",
"thursday": "ar ddydd Iau",
"friday": "ar ddydd Gwener",
"saturday": "ar ddydd Sadwrn",
"next-sunday": "ddydd Sul nesaf",
"next-monday": "ddydd Llun nesaf",
"next-tuesday": "ddydd Mawrth nesaf",
"next-wednesday": "ddydd Mercher nesaf",
"next-thursday": "ddydd Iau nesaf",
"next-friday": "ddydd Gwener nesaf",
"next-saturday": "ddydd Sadwrn nesaf",
"minutes": function(a) {
// 1 funud, 2 funud, X munud
return a + (a === 1 || a === 2 ? " funud" : " munud");
},
"fahrenheit": "$1\u00B0F",
"celsius": "$1\u00B0C",
"inches": "$1 modfedd",
"centimeters": "$1cm",
"less-than": function(a) {
// llai nag 1, llai na 2, …
return "llai na" + (/^(1|8|11|16)[\D\b]/.test(a) ? "g " : " ") + a;
},
"and": function(a, b) {
// don't repeat 'ar'
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 ? "," : "")
// ac not a if second phrase starts with vowel
+ (/^[aeiouwy]/.test(b) ? " ac " : " a ")
// p, t, c -> ph, th, ch mutation
+ b.replace(/^([ptc])(?!h)/,"$1h");
},
"through": function(a, b) {
return "o " + strip_prefix(a) + " hyd at " + strip_prefix(b);
},
"with": "$1, gyda\u2019r $2",
"range": "$1\u2013$2",
"parenthetical": "$1 ($2)",
"for-hour": "$1 am yr awr",
"starting-in": "$1 yn cychwyn mewn $2",
"stopping-in": "$1 yn dod i ben mewn $2",
"starting-then-stopping-later": "$1 yn cychwyn mewn $2, ac yn dod i ben $3 wedyn",
"stopping-then-starting-later": "$1 yn dod i ben mewn $2, gan gychwyn eto $3 wedyn",
"for-day": "$1 drwy\u2019r dydd",
"starting": "$1 yn cychwyn $2", // o?
"until": function(condition, period) {
return condition + " hyd at " + strip_prefix(period); // TR
},
"until-starting-again": function(condition, a, b) {
return condition + " hyd at " + strip_prefix(a) + ", gan gychwyn eto " + b;
},
"starting-continuing-until": function(condition, a, b) {
return condition + " yn cychwyn " + a + ", gan barhau hyd at " + strip_prefix(b);
},
"during": "$1 $2",
"for-week": "$1 drwy’r wythnos",
"over-weekend": "$1 dros y penwythnos",
"temperatures-peaking": "tymheredd ar ei uchaf yn $1 $2",
"temperatures-rising": "tymheredd yn codi i $1 $2",
"temperatures-valleying": "tymheredd ar ei isaf yn $1 $2",
"temperatures-falling": "tymheredd yn gostwng i $1 $2",
// Capitalize the first word.
"title": function(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},
// Capitalize the first word of the sentence and end with a period.
"sentence": function(str) {
// Capitalize.
str = str.charAt(0).toUpperCase() + str.slice(1);
// Add a period if there isn't already one.
if (str.charAt(str.length - 1) !== ".")
str += ".";
return str;
},
};

// strip prefixes (dros/yn/ar)
function strip_prefix(a) {
return a === "dros nos" ? "y nos" : a.replace(/^(?:yn|ar) /, "");
}
162 changes: 162 additions & 0 deletions test_cases/cy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"Clir":
["title", "clear"],

"Gwlybaniaeth ysgafn yn bosib":
["title", "possible-very-light-precipitation"],

"Sych a gwyntoedd ysgafn":
["title", ["and", "low-humidity", "light-wind"]],

"Glaw mân a gwyntoedd cryfion":
["title", ["and", "very-light-rain", "heavy-wind"]],

"Clòs a chymylog":
["title", ["and", "high-humidity", "medium-clouds"]],

"Clir am yr awr.":
["sentence", ["for-hour", "clear"]],

"Eira ysgafn yn cychwyn mewn 35 munud.":
["sentence", ["starting-in", "very-light-snow", ["minutes", 35]]],

"Glaw ysgafn yn dod i ben mewn 15 munud.":
["sentence", ["stopping-in", "light-rain", ["minutes", 15]]],

"Eirlaw trwm yn cychwyn mewn 20 munud, ac yn dod i ben 30 munud wedyn.":
["sentence",
["starting-then-stopping-later",
"heavy-sleet",
["minutes", 20],
["minutes", 30]]],

"Glaw yn dod i ben mewn 25 munud, gan gychwyn eto 8 munud wedyn.":
["sentence",
["stopping-then-starting-later",
"medium-rain",
["minutes", 25],
["minutes", 8]]],

"Cymylog drwy’r dydd.":
["sentence", ["for-day", "medium-clouds"]],

"Eirlaw ysgafn yn cychwyn yn y bore.":
["sentence", ["starting", "very-light-sleet", "morning"]],

"Gwyntog hyd at heno.":
["sentence", ["until", "medium-wind", "today-night"]],

"Gwlybaniaeth trwm hyd at y prynhawn.":
["sentence", ["until", "heavy-precipitation", "afternoon"]],

"Gwyntoedd ysgafn yn y prynhawn.":
["sentence", ["during", "light-wind", "afternoon"]],

"Eira yn hwyrach fin nos heno a bore yfory.":
["sentence", ["during",
"medium-snow",
["and", "later-today-evening", "tomorrow-morning"]]],

"Glaw trwm hyd at hwyrach bore yma, gan gychwyn eto fin nos heno.":
["sentence", ["until-starting-again",
"heavy-rain",
"later-today-morning",
"today-evening"]],

"Cymylau trwchus yn cychwyn fin nos, gan barhau hyd at y nos.":
["sentence", ["starting-continuing-until",
"heavy-clouds",
"evening",
"night"]],

"Eirlaw ysgafn yn hwyrach prynhawn yma a niwlog bore yfory.":
["sentence", ["and",
["during", "light-sleet", "later-today-afternoon"],
["during", "fog", "tomorrow-morning"]]],

"Gwyntoedd cryfion yn cychwyn y bore yma, gan barhau hyd at y prynhawn yma, ac eirlaw bore yfory.":
["sentence", ["and",
["starting-continuing-until",
"heavy-wind",
"today-morning",
"today-afternoon"],
["during", "medium-sleet", "tomorrow-morning"]]],

"Cymylau trwchus yn cychwyn yn hwyrach heno ac eira trwm prynhawn yfory.":
["sentence", ["and",
["starting", "heavy-clouds", "later-today-night"],
["during", "heavy-snow", "tomorrow-afternoon"]]],

"Sych heno a gwlybaniaeth ysgafn yn cychwyn fin nos yfory, gan barhau hyd at nos yfory.":
["sentence", ["and",
["during", "low-humidity", "today-night"],
["starting-continuing-until",
"light-precipitation",
"tomorrow-evening",
"tomorrow-night"]]],

"Eira (5 modfedd) dros nos.":
["sentence", ["during",
["parenthetical", "medium-snow", ["inches", 5]],
"night"]],

"Eira ysgafn (2cm) yn hwyrach bore yma.":
["sentence", ["during",
["parenthetical", "light-snow", ["centimeters", 2]],
"later-today-morning"]],

"Eira trwm (8–12 modfedd) drwy’r dydd.":
["sentence", ["for-day",
["parenthetical", "heavy-snow", ["inches", ["range", 8, 12]]]]],

"Eira (llai nag 11cm) yn y prynhawn.":
["sentence", ["during",
["parenthetical", "medium-snow", ["less-than", ["centimeters", 11]]],
"afternoon"]],

"Dim gwlybaniaeth drwy’r wythnos, gyda’r tymheredd ar ei uchaf yn 85°F yfory.":
["sentence", ["with",
["for-week", "no-precipitation"],
["temperatures-peaking",
["fahrenheit", 85],
"tomorrow"]]],

"Gwlybaniaeth cymysg dros y penwythnos, gyda’r tymheredd yn codi i 32°C ar ddydd Iau.":
["sentence", ["with",
["over-weekend", "mixed-precipitation"],
["temperatures-rising",
["celsius", 32],
"thursday"]]],

"Glaw mân ar ddydd Llun, gyda’r tymheredd ar ei isaf yn 15°F ar ddydd Gwener.":
["sentence", ["with",
["during", "very-light-rain", "monday"],
["temperatures-valleying",
["fahrenheit", 15],
"friday"]]],

"Eira ysgafn ar ddydd Mawrth a dydd Mercher, gyda’r tymheredd yn gostwng i 0°C ar ddydd Sul.":
["sentence", ["with",
["during", "light-snow", ["and", "tuesday", "wednesday"]],
["temperatures-falling",
["celsius", 0],
"sunday"]]],

"Gwlybaniaeth o heddiw hyd at ddydd Sadwrn, gyda’r tymheredd ar ei uchaf yn 100°F ar ddydd Llun.":
["sentence", ["with",
["during",
"medium-precipitation",
["through", "today", "saturday"]],
["temperatures-peaking",
["fahrenheit", 100],
"monday"]]],

"Gwlybaniaeth o ddydd Gwener hyd at ddydd Sadwrn, gyda’r tymheredd ar ei uchaf yn 100°F ar ddydd Llun.":
["sentence", ["with",
["during",
"medium-precipitation",
["through", "friday", "saturday"]],
["temperatures-peaking",
["fahrenheit", 100],
"monday"]]]
}