diff --git a/lib/lang/ga.js b/lib/lang/ga.js new file mode 100644 index 0000000..9bfa696 --- /dev/null +++ b/lib/lang/ga.js @@ -0,0 +1,143 @@ +"use strict"; + +// function join_with_shared_prefix(a, b, joiner) { +// let i = 0; + +// while(i !== a.length && +// i !== b.length && +// a.charCodeAt(i) === b.charCodeAt(i)) +// ++i; + +// while(i && a.charCodeAt(i - 1) !== 32) +// --i; + +// return a + joiner + b.slice(i); +// } + +module.exports = { + "clear": "glan", + "no-precipitation": "ní bheidh frasaíocht ann", + "mixed-precipitation": "frasaíocht éagsúil", + "possible-very-light-precipitation": "seans ar frasaíocht an-éadrom", + "very-light-precipitation": "frasaíocht an-éadrom", + "possible-light-precipitation": "seans ar frasaíocht éadrom", + "light-precipitation": "frasaíocht éadrom", + "medium-precipitation": "frasaíocht", + "heavy-precipitation": "frasaíocht throm", + "possible-very-light-rain": "seans ar fearthainn an-éadrom", + "very-light-rain": "fearthainn an-éadrom", + "possible-light-rain": "seans ar fearthainn éadrom", + "light-rain": "fearthainn éadrom", + "medium-rain": "fearthainn", + "heavy-rain": "fearthainn throm", + "possible-very-light-sleet": "seans ar flichshneachta an-éadrom", + "very-light-sleet": "flichshneachta an-éadrom", + "possible-light-sleet": "seans ar flichshneachta éadrom", + "light-sleet": "flichshneachta éadrom", + "medium-sleet": "flichshneachta", + "heavy-sleet": "flichshneachta trom", + "possible-very-light-snow": "seans ar sneachta an-éadrom", + "very-light-snow": "sneachta an-éadrom", + "possible-light-snow": "seans ar sneachta éadrom", + "light-snow": "sneachta éadrom", + "medium-snow": "sneachta", + "heavy-snow": "sneachta trom", + "possible-thunderstorm": "seans ar stoirm thoirní", + "thunderstorm": "stoirm thoirní", + "light-wind": "laoithne éadrom", + "medium-wind": "laoithne mheasarth", + "heavy-wind": "laoithne láidir", + "low-humidity": "bogthaise íseal", + "high-humidity": "bogthaise ard", + "fog": "ceoch", + "light-clouds": "scamaill bhána", + "medium-clouds": "scamaill mheasartha", + "heavy-clouds": "scamaill throma", + "today-morning": "maidin inniu", + "later-today-morning": "níos déanaí ar maidin inniu", + "today-afternoon": "iarnóin inniu", + "later-today-afternoon": "níos déanaí ar iarnóin inniu", + "today-evening": "tráthnóna inniu", + "later-today-evening": "níos déanaí ar tráthnóna inniu", + "today-night": "anocht", + "later-today-night": "níos déanaí anocht", + "tomorrow-morning": "maidin amárach", + "tomorrow-afternoon": "iarnóin amárach", + "tomorrow-evening": "tráthnóna amárach", + "tomorrow-night": "oiche amárach", + "morning": "ar maidin", + "afternoon": "iarnóin", + "evening": "tráthnóna", + "night": "anocht", + "today": "inniu", + "tomorrow": "amárach", + "sunday": "Dé Domhnaigh", + "monday": "Dé Luain", + "tuesday": "Dé Máirt", + "wednesday": "Dé Céadaoin", + "thursday": "Déardaoin", + "friday": "Dé hAoine", + "saturday": "Dé Sathairn", + "next-sunday": "Dé Domhnaigh seo chugainn", + "next-monday": "Dé Luain seo chugainn", + "next-tuesday": "Dé Máirt seo chugainn", + "next-wednesday": "Dé Céadaoin seo chugainn", + "next-thursday": "Déardaoin seo chugainn", + "next-friday": "Dé hAoine seo chugainn", + "next-saturday": "Dé Sathairn seo chugainn", + "minutes": "$1 nóim.", + "fahrenheit": "$1\u00B0F", + "celsius": "$1\u00B0C", + "inches": "$1 orl.", + "centimeters": "$1 cm.", + "less-than": "< $1", + "and": "$1 agus $2", + "through": "$1 go dtí $2", + "with": "$1, le $2", + "range": "$1\u2013$2", + "parenthetical": "$1 ($2)", + "for-hour": "$1 ar feadh uair an chloig", + "starting-in": "$1 ag tosú i $2", + "stopping-in": "$1 ag stopadh i $2", + "starting-then-stopping-later": "$1 ag tosú i $2, ag stopadh i $3", + "stopping-then-starting-later": "$1 ag stopadh i $2, ag tosú arís i $3", + "for-day": "$1 ar feadh an lae", + "starting": "$1 ag tosú $2", + "until": "$1 ag stopadh $2", + "until-starting-again": "$1 ag stopadh $2, ag tosú arís $3", + "starting-continuing-until": "$1 ag tosú $2, ag stopadh $3", + "during": "$1 $2", + "for-week": "$1 ar feadh na seachtaine", + "over-weekend": "$1 ar feadh an deireadh seachtaine", + "temperatures-peaking": "an teocht dul chomh hard le $1 $2", + "temperatures-rising": "an teteocht dul chomh hard le $1 $2", + "temperatures-valleying": "an teocht dul chomh íseal le $1 $2", + "temperatures-falling": "an teocht dul chomh íseal le $1 $2", + // Capitalize the first letter of every word, except if that word is + // "and". (This is a very crude bastardization of proper English titling + // rules, but it is adequate for the purposes of this module.) + "title": function(str) { + return str.replace(/\S+/g, function(word) { + return word === "Agus" ? + word : + word.charAt(0).toUpperCase() + word.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; + }, + "next-hour-forecast-status": "níl réamhaisnéise an uair seo chugainn $1 mar go bhfuil $2", + "unavailable": "ar fáil", + "temporarily-unavailable": "ar fáil i láthair na huaire", + "partially-unavailable": "ar fáil go hiomlán", + "station-offline": "gach stáisiún radair atá in aice láimhe as líne", + "station-incomplete": "bearnaí san fhaisnéis ó na stáisiúin radair atá in aice láimhe", +}; diff --git a/test_cases/ga.json b/test_cases/ga.json new file mode 100644 index 0000000..1833603 --- /dev/null +++ b/test_cases/ga.json @@ -0,0 +1,252 @@ +{ + "Glan": + ["title", "clear"], + + "Seans Ar Frasaíocht An-éadrom": + ["title", "possible-very-light-precipitation"], + + "Frasaíocht An-éadrom": + ["title", "very-light-precipitation"], + + "Seans Ar Frasaíocht Éadrom": + ["title", "possible-light-precipitation"], + + "Frasaíocht Éadrom": + ["title", "light-precipitation"], + + "Frasaíocht": + ["title", "medium-precipitation"], + + "Frasaíocht Throm": + ["title", "heavy-precipitation"], + + "Seans Ar Fearthainn An-éadrom": + ["title", "possible-very-light-rain"], + + "Fearthainn An-éadrom": + ["title", "very-light-rain"], + + "Seans Ar Fearthainn Éadrom": + ["title", "possible-light-rain"], + + "Fearthainn Éadrom": + ["title", "light-rain"], + + "Fearthainn": + ["title", "medium-rain"], + + "Fearthainn Throm": + ["title", "heavy-rain"], + + "Seans Ar Flichshneachta An-éadrom": + ["title", "possible-very-light-sleet"], + + "Flichshneachta An-éadrom": + ["title", "very-light-sleet"], + + "Seans Ar Flichshneachta Éadrom": + ["title", "possible-light-sleet"], + + "Flichshneachta Éadrom": + ["title", "light-sleet"], + + "Flichshneachta": + ["title", "medium-sleet"], + + "Flichshneachta Trom": + ["title", "heavy-sleet"], + + "Seans Ar Sneachta An-éadrom": + ["title", "possible-very-light-snow"], + + "Sneachta An-éadrom": + ["title", "very-light-snow"], + + "Seans Ar Sneachta Éadrom": + ["title", "possible-light-snow"], + + "Sneachta Éadrom": + ["title", "light-snow"], + + "Sneachta": + ["title", "medium-snow"], + + "Sneachta Trom": + ["title", "heavy-snow"], + + "Laoithne Mheasarth": + ["title", "medium-wind"], + + "Laoithne Láidir": + ["title", "heavy-wind"], + + "Ceoch": + ["title", "fog"], + + "Scamaill Mheasartha": + ["title", "medium-clouds"], + + "Scamaill Throma": + ["title", "heavy-clouds"], + + "Bogthaise Íseal Agus Laoithne Éadrom": + ["title", ["and", "low-humidity", "light-wind"]], + + "Fearthainn An-éadrom Agus Laoithne Láidir": + ["title", ["and", "very-light-rain", "heavy-wind"]], + + "Bogthaise Ard Agus Scamaill Bhána": + ["title", ["and", "high-humidity", "light-clouds"]], + + "Glan ar feadh uair an chloig.": + ["sentence", ["for-hour", "clear"]], + + "Sneachta an-éadrom ag tosú i 35 nóim.": + ["sentence", ["starting-in", "very-light-snow", ["minutes", 35]]], + + "Fearthainn éadrom ag stopadh i 15 nóim.": + ["sentence", ["stopping-in", "light-rain", ["minutes", 15]]], + + "Flichshneachta trom ag tosú i 20 nóim., ag stopadh i 30 nóim.": + ["sentence", + ["starting-then-stopping-later", + "heavy-sleet", + ["minutes", 20], + ["minutes", 30]]], + + "Fearthainn ag stopadh i 25 nóim., ag tosú arís i 8 nóim.": + ["sentence", + ["stopping-then-starting-later", + "medium-rain", + ["minutes", 25], + ["minutes", 8]]], + + "Scamaill mheasartha ar feadh an lae.": + ["sentence", ["for-day", "medium-clouds"]], + + "Flichshneachta an-éadrom ag tosú ar maidin.": + ["sentence", ["starting", "very-light-sleet", "morning"]], + + "Laoithne mheasarth ag stopadh anocht.": + ["sentence", ["until", "medium-wind", "today-night"]], + + "Frasaíocht throm ag stopadh iarnóin.": + ["sentence", ["until", "heavy-precipitation", "afternoon"]], + + "Laoithne éadrom iarnóin.": + ["sentence", ["during", "light-wind", "afternoon"]], + + "Sneachta níos déanaí ar tráthnóna inniu agus maidin amárach.": + ["sentence", ["during", + "medium-snow", + ["and", "later-today-evening", "tomorrow-morning"]]], + + "Fearthainn throm ag stopadh níos déanaí ar maidin inniu, ag tosú arís tráthnóna inniu.": + ["sentence", ["until-starting-again", + "heavy-rain", + "later-today-morning", + "today-evening"]], + + "Scamaill throma ag tosú tráthnóna, ag stopadh anocht.": + ["sentence", ["starting-continuing-until", + "heavy-clouds", + "evening", + "night"]], + + "Flichshneachta éadrom níos déanaí ar iarnóin inniu agus ceoch maidin amárach.": + ["sentence", ["and", + ["during", "light-sleet", "later-today-afternoon"], + ["during", "fog", "tomorrow-morning"]]], + + "Laoithne láidir ag tosú maidin inniu, ag stopadh iarnóin inniu agus flichshneachta maidin amárach.": + ["sentence", ["and", + ["starting-continuing-until", + "heavy-wind", + "today-morning", + "today-afternoon"], + ["during", "medium-sleet", "tomorrow-morning"]]], + + "Scamaill throma ag tosú níos déanaí anocht agus sneachta trom iarnóin amárach.": + ["sentence", ["and", + ["starting", "heavy-clouds", "later-today-night"], + ["during", "heavy-snow", "tomorrow-afternoon"]]], + + "Bogthaise íseal anocht agus frasaíocht éadrom ag tosú tráthnóna amárach, ag stopadh oiche amárach.": + ["sentence", ["and", + ["during", "low-humidity", "today-night"], + ["starting-continuing-until", + "light-precipitation", + "tomorrow-evening", + "tomorrow-night"]]], + + "Sneachta (5 orl.) anocht.": + ["sentence", ["during", + ["parenthetical", "medium-snow", ["inches", 5]], + "night"]], + + "Sneachta éadrom (2 cm.) níos déanaí ar maidin inniu.": + ["sentence", ["during", + ["parenthetical", "light-snow", ["centimeters", 2]], + "later-today-morning"]], + + "Sneachta trom (8\u201312 orl.) ar feadh an lae.": + ["sentence", ["for-day", + ["parenthetical", "heavy-snow", ["inches", ["range", 8, 12]]]]], + + "Sneachta (< 1 cm.) iarnóin.": + ["sentence", ["during", + ["parenthetical", "medium-snow", ["less-than", ["centimeters", 1]]], + "afternoon"]], + + + "Ní bheidh frasaíocht ann ar feadh na seachtaine, le an teocht dul chomh hard le 85\u00B0F amárach.": + ["sentence", ["with", + ["for-week", "no-precipitation"], + ["temperatures-peaking", + ["fahrenheit", 85], + "tomorrow"]]], + + "Frasaíocht éagsúil ar feadh an deireadh seachtaine, le an teteocht dul chomh hard le 32\u00B0C Déardaoin.": + ["sentence", ["with", + ["over-weekend", "mixed-precipitation"], + ["temperatures-rising", + ["celsius", 32], + "thursday"]]], + + "Fearthainn an-éadrom Dé Luain, le an teocht dul chomh íseal le 15\u00B0F Dé hAoine.": + ["sentence", ["with", + ["during", "very-light-rain", "monday"], + ["temperatures-valleying", + ["fahrenheit", 15], + "friday"]]], + + "Sneachta éadrom Dé Máirt agus Dé Céadaoin seo chugainn, le an teocht dul chomh íseal le 0\u00B0C Dé Domhnaigh.": + ["sentence", ["with", + ["during", "light-snow", ["and", "tuesday", "next-wednesday"]], + ["temperatures-falling", + ["celsius", 0], + "sunday"]]], + + "Frasaíocht inniu go dtí Dé Sathairn, le an teocht dul chomh hard le 100\u00B0F Dé Luain.": + ["sentence", ["with", + ["during", + "medium-precipitation", + ["through", "today", "saturday"]], + ["temperatures-peaking", + ["fahrenheit", 100], + "monday"]]], + + "Seans ar stoirm thoirní Dé Céadaoin seo chugainn agus Déardaoin seo chugainn.": + ["sentence", ["during", + "possible-thunderstorm", + ["and", "next-wednesday", "next-thursday"] + ]], + "Níl réamhaisnéise an uair seo chugainn ar fáil i láthair na huaire mar go bhfuil gach stáisiún radair atá in aice láimhe as líne.": + ["sentence", ["next-hour-forecast-status", "temporarily-unavailable", "station-offline"]], + + "Níl réamhaisnéise an uair seo chugainn ar fáil go hiomlán mar go bhfuil bearnaí san fhaisnéis ó na stáisiúin radair atá in aice láimhe.": + ["sentence", ["next-hour-forecast-status", "partially-unavailable", "station-incomplete"]], + + "Níl réamhaisnéise an uair seo chugainn ar fáil mar go bhfuil gach stáisiún radair atá in aice láimhe as líne.": + ["sentence", ["next-hour-forecast-status", "unavailable", "station-offline"]] +}