Skip to content

Commit

Permalink
Create gd.js (darkskyapp#234)
Browse files Browse the repository at this point in the history
* Create gd.js

Create Gàidhlig (Scottish Gaelic) translation

* Update gd.js

* Update gd.js

* Update gd.js

* Update gd.js

* Create gd.json test case

* Update gd.js

* Corrections in gd.json

* Corrections in gd.js

* Correct title case in gd.json

* Corrections in gd.json

* Corrections in gd.js

* Corrections in gd.json

* Corrections in gd.js

* Corrections in gd.json

* Corrections in gd.js

* Corrections in gd.json

* Corrections in gd.json

* Update gd.js

* Update gd.json

* Update gd.js

* Update gd.js

* Update gd.js

* Update gd.js

* Update gd.js

* Update gd.json

* Update gd.json

* Update gd.json

* Removed extra space
  • Loading branch information
Chris Mitchell authored and Jay LaPorte committed Jan 6, 2020
1 parent 917a9f1 commit d3a2a92
Show file tree
Hide file tree
Showing 2 changed files with 393 additions and 0 deletions.
147 changes: 147 additions & 0 deletions lib/lang/gd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
"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": "soilleir",
"no-precipitation": "gun sileadh",
"mixed-precipitation": "sileadh measgaichte",
"possible-very-light-precipitation": "tha cothrom ann gum bi sileadh glè aotrom ann",
"very-light-precipitation": "sileadh glè aotrom",
"possible-light-precipitation": "tha cothrom ann gum bi sileadh aotrom ann",
"light-precipitation": "sileadh aotrom",
"medium-precipitation": "sileadh",
"heavy-precipitation": "sileadh trom",
"possible-very-light-rain": "tha cothrom ann gum bi uisge glè aotrom ann",
"very-light-rain": "uisge glè aotrom",
"possible-light-rain": "tha cothrom ann gum bi uisge aotrom ann",
"light-rain": "uisge aotrom",
"medium-rain": "uisge",
"heavy-rain": "uisge trom",
"possible-very-light-sleet": "tha cothrom ann gum bi flin glè aotrom ann",
"very-light-sleet": "flin glè aotrom",
"possible-light-sleet": "tha cothrom ann gum bi flin aotrom ann",
"light-sleet": "flin aotrom",
"medium-sleet": "flin",
"heavy-sleet": "flin trom",
"possible-very-light-snow": "tha cothrom ann gum bi fras sneachda ann",
"very-light-snow": "frasan sneachda",
"possible-light-snow": "tha cothrom ann gum bi sneachd aotrom ann",
"light-snow": "sneachd aotrom",
"medium-snow": "sneachd",
"heavy-snow": "sneachda trom",
"possible-thunderstorm": "tha cothrom ann gum bi stoirmean tàirneanaich ann",
"thunderstorm": "stoirmean tàirneanaich",
"light-wind": "oiteag shocair",
"medium-wind": "gaoth",
"heavy-wind": "gaoth chunnartach",
"low-humidity": "tioram",
"high-humidity": "tais",
"fog": "ceòthach",
"light-clouds": "sgothan aotrom",
"medium-clouds": "sgothach",
"heavy-clouds": "sgothan trom",
"today-morning": "madainn an-diugh",
"later-today-morning": "nas anmoiche madainn an-diugh",
"today-afternoon": "feasgar an-diugh",
"later-today-afternoon": "nas anmoiche feasgar an-diugh",
"today-evening": "feasgar an-diugh",
"later-today-evening": "nas anmoiche feasgar an-diugh",
"today-night": "a-nochd",
"later-today-night": "nas anmoiche a-nochd",
"tomorrow-morning": "madainn a-màireach",
"tomorrow-afternoon": "feasgar a-màireach",
"tomorrow-evening": "feasgar a-màireach",
"tomorrow-night": "an ath oidhche",
"morning": "anns a' mhadainn",
"afternoon": "anns an fheasgar",
"evening": "anns an fheasgar",
"night": "a-nochd",
"today": "an-diugh",
"tomorrow": "a-màireach",
"sunday": "Didòmhnaich",
"monday": "Diluain",
"tuesday": "Dimàirt",
"wednesday": "Diciadain",
"thursday": "Diardaoin",
"friday": "Dihaoine",
"saturday": "Disathairne",
"next-sunday": "Didòmhnaich an ath sheachdain",
"next-monday": "Diluain an ath sheachdain",
"next-tuesday": "Dimàirt an ath sheachdain",
"next-wednesday": "Diciadain an ath sheachdain",
"next-thursday": "Diardaoin an ath sheachdain",
"next-friday": "Dihaoine an ath sheachdain",
"next-saturday": "Disathairne an ath sheachdain",
"minutes": "$1 mion.",
"fahrenheit": "$1\u00B0F",
"celsius": "$1\u00B0C",
"inches": "$1 òir.",
"centimeters": "$1 cm.",
"less-than": "< $1",
"and": function(a, b) {
return join_with_shared_prefix(
a,
b,
a.indexOf(",") !== -1 ? ", agus " : " agus "
);
},
"through": function(a, b) {
return join_with_shared_prefix(a, b, " tro ");
},
"with": "$1, le $2",
"range": "$1\u2013$2",
"parenthetical": "$1 ($2)",
"for-hour": "$1 fad uair a thìde",
"starting-in": "$1 a' tòiseachadh ann an $2",
"stopping-in": "$1 a' stad ann an $2",
"starting-then-stopping-later": "$1 a' tòiseachadh ann an $2, a' stad as dèidh $3",
"stopping-then-starting-later": "$1 a' stad ann an $2, a' tòiseachadh a-rithist as dèidh $3",
"for-day": "$1 fad an latha",
"starting": "$1 a' tòiseachadh $2",
"until": "$1 a' stad $2",
"until-starting-again": "$1 a' stad $2, a' tòiseachadh a-rithist $3",
"starting-continuing-until": "$1 a' tòiseachadh $2, a' stad $3",
"during": "$1 $2",
"for-week": "$1 fad na seachdain",
"over-weekend": "$1 thairis air an deireadh-sheachdain",
"temperatures-peaking": "an teòthachd as àirde a' ruigsinn $1 $2",
"temperatures-rising": "an teòthachd as àirde a' ruigsinn $1 $2",
"temperatures-valleying": "an teòthachd as àirde a' tuiteam gu $1 $2",
"temperatures-falling": "an teòthachd as àirde a' tuiteam gu $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;
},
"unavailable-radar": "Cha deach dad a lorg an-dràsta air sgàth 's $1.",
"station-offline": "gu bheil a h-uile stèisean-radar far loidhne",
};
246 changes: 246 additions & 0 deletions test_cases/gd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"Soilleir":
["title", "clear"],

"Tha Cothrom Ann Gum Bi Sileadh Glè Aotrom Ann":
["title", "possible-very-light-precipitation"],

"Sileadh Glè Aotrom":
["title", "very-light-precipitation"],

"Tha Cothrom Ann Gum Bi Sileadh Aotrom Ann":
["title", "possible-light-precipitation"],

"Sileadh Aotrom":
["title", "light-precipitation"],

"Sileadh":
["title", "medium-precipitation"],

"Sileadh Trom":
["title", "heavy-precipitation"],

"Tha Cothrom Ann Gum Bi Uisge Glè Aotrom Ann":
["title", "possible-very-light-rain"],

"Uisge Glè Aotrom":
["title", "very-light-rain"],

"Tha Cothrom Ann Gum Bi Uisge Aotrom Ann":
["title", "possible-light-rain"],

"Uisge Aotrom":
["title", "light-rain"],

"Uisge":
["title", "medium-rain"],

"Uisge Trom":
["title", "heavy-rain"],

"Tha Cothrom Ann Gum Bi Flin Glè Aotrom Ann":
["title", "possible-very-light-sleet"],

"Flin Glè Aotrom":
["title", "very-light-sleet"],

"Tha Cothrom Ann Gum Bi Flin Aotrom Ann":
["title", "possible-light-sleet"],

"Flin Aotrom":
["title", "light-sleet"],

"Flin":
["title", "medium-sleet"],

"Flin Trom":
["title", "heavy-sleet"],

"Tha Cothrom Ann Gum Bi Fras Sneachda Ann":
["title", "possible-very-light-snow"],

"Frasan Sneachda":
["title", "very-light-snow"],

"Tha Cothrom Ann Gum Bi Sneachd Aotrom Ann":
["title", "possible-light-snow"],

"Sneachd Aotrom":
["title", "light-snow"],

"Sneachd":
["title", "medium-snow"],

"Sneachda Trom":
["title", "heavy-snow"],

"Gaoth":
["title", "medium-wind"],

"Gaoth Chunnartach":
["title", "heavy-wind"],

"Ceòthach":
["title", "fog"],

"Sgothach":
["title", "medium-clouds"],

"Sgothan Trom":
["title", "heavy-clouds"],

"Tioram Agus Oiteag Shocair":
["title", ["and", "low-humidity", "light-wind"]],

"Uisge Glè Aotrom Agus Gaoth Chunnartach":
["title", ["and", "very-light-rain", "heavy-wind"]],

"Tais Agus Sgothan Aotrom":
["title", ["and", "high-humidity", "light-clouds"]],


"Soilleir fad uair a thìde.":
["sentence", ["for-hour", "clear"]],

"Frasan sneachda a' tòiseachadh ann an 35 mion.":
["sentence", ["starting-in", "very-light-snow", ["minutes", 35]]],

"Uisge aotrom a' stad ann an 15 mion.":
["sentence", ["stopping-in", "light-rain", ["minutes", 15]]],

"Flin trom a' tòiseachadh ann an 20 mion., a' stad as dèidh 30 mion.":
["sentence",
["starting-then-stopping-later",
"heavy-sleet",
["minutes", 20],
["minutes", 30]]],

"Uisge a' stad ann an 25 mion., a' tòiseachadh a-rithist as dèidh 8 mion.":
["sentence",
["stopping-then-starting-later",
"medium-rain",
["minutes", 25],
["minutes", 8]]],


"Sgothach fad an latha.":
["sentence", ["for-day", "medium-clouds"]],

"Flin glè aotrom a' tòiseachadh anns a' mhadainn.":
["sentence", ["starting", "very-light-sleet", "morning"]],

"Gaoth a' stad a-nochd.":
["sentence", ["until", "medium-wind", "today-night"]],

"Sileadh trom a' stad anns an fheasgar.":
["sentence", ["until", "heavy-precipitation", "afternoon"]],

"Oiteag shocair anns an fheasgar.":
["sentence", ["during", "light-wind", "afternoon"]],

"Sneachd nas anmoiche feasgar an-diugh agus madainn a-màireach.":
["sentence", ["during",
"medium-snow",
["and", "later-today-evening", "tomorrow-morning"]]],

"Uisge trom a' stad nas anmoiche madainn an-diugh, a' tòiseachadh a-rithist feasgar an-diugh.":
["sentence", ["until-starting-again",
"heavy-rain",
"later-today-morning",
"today-evening"]],

"Sgothan trom a' tòiseachadh anns an fheasgar, a' stad a-nochd.":
["sentence", ["starting-continuing-until",
"heavy-clouds",
"evening",
"night"]],

"Flin aotrom nas anmoiche feasgar an-diugh agus ceòthach madainn a-màireach.":
["sentence", ["and",
["during", "light-sleet", "later-today-afternoon"],
["during", "fog", "tomorrow-morning"]]],

"Gaoth chunnartach a' tòiseachadh madainn an-diugh, a' stad feasgar an-diugh, agus flin madainn a-màireach.":
["sentence", ["and",
["starting-continuing-until",
"heavy-wind",
"today-morning",
"today-afternoon"],
["during", "medium-sleet", "tomorrow-morning"]]],

"Sgothan trom a' tòiseachadh nas anmoiche a-nochd agus sneachda trom feasgar a-màireach.":
["sentence", ["and",
["starting", "heavy-clouds", "later-today-night"],
["during", "heavy-snow", "tomorrow-afternoon"]]],

"Tioram a-nochd agus sileadh aotrom a' tòiseachadh feasgar a-màireach, a' stad an ath oidhche.":
["sentence", ["and",
["during", "low-humidity", "today-night"],
["starting-continuing-until",
"light-precipitation",
"tomorrow-evening",
"tomorrow-night"]]],

"Sneachd (5 òir.) a-nochd.":
["sentence", ["during",
["parenthetical", "medium-snow", ["inches", 5]],
"night"]],

"Sneachd aotrom (2 cm.) nas anmoiche madainn an-diugh.":
["sentence", ["during",
["parenthetical", "light-snow", ["centimeters", 2]],
"later-today-morning"]],

"Sneachda trom (8\u201312 òir.) fad an latha.":
["sentence", ["for-day",
["parenthetical", "heavy-snow", ["inches", ["range", 8, 12]]]]],

"Sneachd (< 1 cm.) anns an fheasgar.":
["sentence", ["during",
["parenthetical", "medium-snow", ["less-than", ["centimeters", 1]]],
"afternoon"]],


"Gun sileadh fad na seachdain, le an teòthachd as àirde a' ruigsinn 85\u00B0F a-màireach.":
["sentence", ["with",
["for-week", "no-precipitation"],
["temperatures-peaking",
["fahrenheit", 85],
"tomorrow"]]],

"Sileadh measgaichte thairis air an deireadh-sheachdain, le an teòthachd as àirde a' ruigsinn 32\u00B0C Diardaoin.":
["sentence", ["with",
["over-weekend", "mixed-precipitation"],
["temperatures-rising",
["celsius", 32],
"thursday"]]],

"Uisge glè aotrom Diluain, le an teòthachd as àirde a' tuiteam gu 15\u00B0F Dihaoine.":
["sentence", ["with",
["during", "very-light-rain", "monday"],
["temperatures-valleying",
["fahrenheit", 15],
"friday"]]],

"Sneachd aotrom Dimàirt agus Diciadain an ath sheachdain, le an teòthachd as àirde a' tuiteam gu 0\u00B0C Didòmhnaich.":
["sentence", ["with",
["during", "light-snow", ["and", "tuesday", "next-wednesday"]],
["temperatures-falling",
["celsius", 0],
"sunday"]]],

"Sileadh an-diugh tro Disathairne, le an teòthachd as àirde a' ruigsinn 100\u00B0F Diluain.":
["sentence", ["with",
["during",
"medium-precipitation",
["through", "today", "saturday"]],
["temperatures-peaking",
["fahrenheit", 100],
"monday"]]],

"Tha cothrom ann gum bi stoirmean tàirneanaich ann Diciadain an ath sheachdain agus Diardaoin an ath sheachdain.":
["sentence", ["during",
"possible-thunderstorm",
["and", "next-wednesday", "next-thursday"]
]]
}

0 comments on commit d3a2a92

Please sign in to comment.