Repository: darkskyapp/forecast-io-translations
Pull request #81 (2016-09-05 13:44:29)

Estonian translation for the Forecast IO API
This is my translation in Estonian. Both .js and .json files included. Both passed the tests with flying colours.


Patch:
diff --git a/lib/lang/et.js b/lib/lang/et.js
new file mode 100644
index 0000000..858ff5e
--- /dev/null
+++ b/lib/lang/et.js
@@ -0,0 +1,345 @@
+function join_with_shared_prefix(a, b, joiner) {
+
+  var m = a,
+
+      i = 0,
+
+      j;
+
+
+
+
+  while(i !== m.length &&
+
+        i !== b.length &&
+
+        m.charCodeAt(i) === b.charCodeAt(i))
+
+    ++i;
+
+
+
+
+  while(i && m.charCodeAt(i - 1) !== 32)
+
+    --i;
+
+
+
+
+  return a + joiner + b.slice(i);
+
+}
+
+
+
+
+var grammar = {
+
+  "täna": ["tänasest", null],
+
+  "homme": ["homsest", "homseni"],
+
+  "öösel": ["ööst", "ööni"],
+
+  "õhtu": ["õhtust", "õhtuni"],
+
+  "hommikul": ["hommikust", "hommikuni"],
+
+  "õhtul": ["õhtust", "õhtuni"],
+
+  "pärastlõunal": ["pärastlõunast", "pärastlõunani"],
+
+  "homme hommikul": ["homme hommikust", "homse hommikuni"],
+
+  "hiljem õhtul": ["hilisemast õhtust", "hilisema õhtuni"],
+
+  "hiljem öösel": ["hilisemast ööst", "hilisema ööni"],
+
+  "homme pärastlõunal": ["homsest pärastlõunast", "homse pärastlõunani"],
+
+  "homme õhtul": ["homsest õhtust", "homse õhtuni"],
+
+  "homme öösel": ["homsest ööst", "homse ööni"],
+
+  "esmaspäeval": ["esmaspäevast", "esmaspäevani"],
+
+  "teisipäeval": ["teisipäevast", "teisipäevani"],
+
+  "kolmapäeval": ["kolmapäevast", "kolmapäevani"],
+
+  "neljapäeval": ["neljapäevast", "neljapäevani"],
+
+  "reedel": ["reedest", "reedeni"],
+
+  "laupäeval": ["laupäevast", "laupäevani"],
+
+  "pühapäeval": ["pühapäevast", "pühapäevani"]
+
+};
+
+
+
+
+function elative(word) {
+
+  return grammar.hasOwnProperty(word)? grammar[word][0]: word;
+
+}
+
+
+
+
+function illative(word){
+
+  return grammar.hasOwnProperty(word)? grammar[word][1]: word;
+
+}
+
+
+
+
+module.exports = require("../template")({
+
+  "clear": "selge",
+
+  "no-precipitation": "kuiv",
+
+  "mixed-precipitation": "erinevad sademed",
+
+  "possible-very-light-precipitation": "nõrga saju võimalus",
+
+  "very-light-precipitation": "nõrk sadu",
+
+  "possible-light-precipitation": "kerge saju võimalus",
+
+  "light-precipitation": "kerge sadu",
+
+  "medium-precipitation": "mõõdukas sadu",
+
+  "heavy-precipitation": "tugev sadu",
+
+  "possible-very-light-rain": "nõrga vihmasaju võimalus",
+
+  "very-light-rain": "nõrk vihmasadu",
+
+  "possible-light-rain": "kerge vihmasaju võimalus",
+
+  "light-rain": "kerge vihmasadu",
+
+  "medium-rain": "mõõdukas vihmasadu",
+
+  "heavy-rain": "tugev vihmasadu",
+
+  "possible-very-light-sleet": "nõrga lörtsisaju võimalus",
+
+  "very-light-sleet": "nõrk lörtsisadu",
+
+  "possible-light-sleet": "kerge lörtsisaju võimalus",
+
+  "light-sleet": "kerge lörtsisadu",
+
+  "medium-sleet": "mõõdukas lörtsisadu",
+
+  "heavy-sleet": "tugev lörtsisadu",
+
+  "possible-very-light-snow": "nõrga lumesaju võimalus",
+
+  "very-light-snow": "nõrk lumesadu",
+
+  "possible-light-snow": "kerge lumesaju võimalus",
+
+  "light-snow": "kerge lumesadu",
+
+  "medium-snow": "mõõdukas lumesadu",
+
+  "heavy-snow": "tugev lumesadu",
+
+  "light-wind": "kerge tuul",
+
+  "medium-wind": "mõõdukas tuul",
+
+  "heavy-wind": "tugev tuul",
+
+  "low-humidity": "kuiv",
+
+  "high-humidity": "niiske",
+
+  "fog": "udu",
+
+  "light-clouds": "vähene pilvisus",
+
+  "medium-clouds": "mõõdukas pilvisus",
+
+  "heavy-clouds": "pilves",
+
+  "today-morning": "hommikul",
+
+  "later-today-morning": "hiljem täna hommikul",
+
+  "today-afternoon": "pärastlõunal",
+
+  "later-today-afternoon": "hiljem pärastlõunal",
+
+  "today-evening": "õhtul",
+
+  "later-today-evening": "hiljem õhtul",
+
+  "today-night": "öösel",
+
+  "later-today-night": "hiljem öösel",
+
+  "tomorrow-morning": "homme hommikul",
+
+  "tomorrow-afternoon": "homme pärastlõunal",
+
+  "tomorrow-evening": "homme õhtul",
+
+  "tomorrow-night": "homme öösel",
+
+  "morning": "hommikul",
+
+  "afternoon": "pärastlõunal",
+
+  "evening": "õhtul",
+
+  "night": "öösel",
+
+  "today": "täna",
+
+  "tomorrow": "homme",
+
+  "sunday": "pühapäeval",
+
+  "monday": "esmaspäeval",
+
+  "tuesday": "teisipäeval",
+
+  "wednesday": "kolmapäeval",
+
+  "thursday": "neljapäeval",
+
+  "friday": "reedel",
+
+  "saturday": "laupäeval",
+
+  "minutes": "$1 min.",
+
+  "fahrenheit": "$1\u00B0F",
+
+  "celsius": "$1\u00B0C",
+
+  "inches": "$1 tolli",
+
+  "centimeters": "$1 cm",
+
+  "less-than": "alla $1",
+
+  "and": function(a, b) {
+
+    return join_with_shared_prefix(a, b, " ja ");
+
+  },
+
+  "through": function(a, b) {
+
+    a = elative(a);
+
+    b = illative(b);
+
+    return (a && b)? a + " kuni " + b:
+
+           (a || b)? (a || b) + " kuni":
+
+                     "";
+
+  },
+
+  "with": "$1, $2",
+
+  "range": "$1\u2013$2",
+
+  "parenthetical": "$1 ($2)",
+
+  "for-hour": "$1 järgmised tund aega",
+
+  "starting-in": "$1 oodata $2 pärast",
+
+  "stopping-in": "$1 lõppeb $2 pärast",
+
+  "starting-then-stopping-later": "$1 algab $2 pärast, lõppeb $3 hiljem",
+
+  "stopping-then-starting-later": "$1 lõppeb $2 pärast, algab uuesti $3 hiljem",
+
+  "for-day": "Terve päev on $1",
+
+  "starting": function(condition, period){
+
+    return condition + " alates " + elative(period); 
+
+  },
+
+  "until": function(condition, period) {
+
+    return condition + " kuni " + illative(period);
+
+  },
+
+  "until-starting-again": function(condition, a, b) {
+
+    return condition + " " + illative(a) + ", ja jälle " + b;
+
+  },
+
+  "starting-continuing-until": function(condition, a, b) {
+
+    return condition + " " + elative(a) + " " + illative(b);
+
+  },
+
+  "during": "$1 $2",
+
+  "for-week": "$1 nädal aega",
+
+  "over-weekend": "$1 nädalavahetusel",
+
+  "temperatures-peaking": "temperatuur tõuseb $2 kuni $1",
+
+  "temperatures-rising": "temperatuur tõuseb $2 kuni $1",
+
+  "temperatures-valleying": "temperatuur langeb $2 kuni $1",
+
+  "temperatures-falling": "temperatuur langeb $2 kuni $1",
+
+  /* Capitalize the first character in the word.*/
+
+  "title": function(str) {
+
+    str = str.charAt(0).toUpperCase() + str.slice(1);
+
+    return str;
+
+  },
+
+  /* Capitalize the first word of the sentence and end with a period. */
+
+  "sentence": function(str) {
+
+    str = str.charAt(0).toUpperCase() + str.slice(1);
+
+
+
+
+    if(str.charAt(str.length - 1) !== ".")
+
+      str += ".";
+
+
+
+
+    return str;
+
+  }
+
+});
+


Test patch:
diff --git a/test_cases/et.json b/test_cases/et.json
new file mode 100644
index 0000000..0dc4323
--- /dev/null
+++ b/test_cases/et.json
@@ -0,0 +1,560 @@
+{
+
+  "Selge":
+
+    ["title", "clear"],
+
+
+
+
+  "Nõrga saju võimalus":
+
+    ["title", "possible-very-light-precipitation"],
+
+
+
+
+  "Nõrk sadu":
+
+    ["title", "very-light-precipitation"],
+
+
+
+
+  "Kerge saju võimalus":
+
+    ["title", "possible-light-precipitation"],
+
+
+
+
+  "Kerge sadu":
+
+    ["title", "light-precipitation"],
+
+
+
+
+  "Mõõdukas sadu":
+
+    ["title", "medium-precipitation"],
+
+
+
+
+  "Tugev sadu":
+
+    ["title", "heavy-precipitation"],
+
+
+
+
+  "Nõrga vihmasaju võimalus":
+
+    ["title", "possible-very-light-rain"],
+
+
+
+
+  "Nõrk vihmasadu":
+
+    ["title", "very-light-rain"],
+
+
+
+
+  "Kerge vihmasaju võimalus":
+
+    ["title", "possible-light-rain"],
+
+
+
+
+  "Kerge vihmasadu":
+
+    ["title", "light-rain"],
+
+
+
+
+  "Mõõdukas vihmasadu":
+
+    ["title", "medium-rain"],
+
+
+
+
+  "Tugev vihmasadu":
+
+    ["title", "heavy-rain"],
+
+
+
+
+  "Nõrga lörtsisaju võimalus":
+
+    ["title", "possible-very-light-sleet"],
+
+
+
+
+  "Nõrk lörtsisadu":
+
+    ["title", "very-light-sleet"],
+
+
+
+
+  "Kerge lörtsisaju võimalus":
+
+    ["title", "possible-light-sleet"],
+
+
+
+
+  "Kerge lörtsisadu":
+
+    ["title", "light-sleet"],
+
+
+
+
+  "Mõõdukas lörtsisadu":
+
+    ["title", "medium-sleet"],
+
+
+
+
+  "Tugev lörtsisadu":
+
+    ["title", "heavy-sleet"],
+
+
+
+
+  "Nõrga lumesaju võimalus":
+
+    ["title", "possible-very-light-snow"],
+
+
+
+
+  "Nõrk lumesadu":
+
+    ["title", "very-light-snow"],
+
+
+
+
+  "Kerge lumesaju võimalus":
+
+    ["title", "possible-light-snow"],
+
+
+
+
+  "Kerge lumesadu":
+
+    ["title", "light-snow"],
+
+
+
+
+  "Mõõdukas lumesadu":
+
+    ["title", "medium-snow"],
+
+
+
+
+  "Tugev lumesadu":
+
+    ["title", "heavy-snow"],
+
+
+
+
+  "Mõõdukas tuul":
+
+    ["title", "medium-wind"],
+
+
+
+
+  "Tugev tuul":
+
+    ["title", "heavy-wind"],
+
+
+
+
+  "Udu":
+
+    ["title", "fog"],
+
+
+
+
+  "Mõõdukas pilvisus":
+
+    ["title", "medium-clouds"],
+
+
+
+
+  "Pilves":
+
+    ["title", "heavy-clouds"],
+
+
+
+
+  "Kuiv ja kerge tuul":
+
+    ["title", ["and", "low-humidity", "light-wind"]],
+
+
+
+
+  "Nõrk vihmasadu ja tugev tuul":
+
+    ["title", ["and", "very-light-rain", "heavy-wind"]],
+
+
+
+
+  "Niiske ja vähene pilvisus":
+
+    ["title", ["and", "high-humidity", "light-clouds"]],
+
+
+
+
+  "Selge järgmised tund aega.":
+
+    ["sentence", ["for-hour", "clear"]],
+
+
+
+
+  "Nõrk lumesadu oodata 35 min. pärast.":
+
+    ["sentence", ["starting-in", "very-light-snow", ["minutes", 35]]],
+
+
+
+
+  "Kerge vihmasadu lõppeb 15 min. pärast.":
+
+    ["sentence", ["stopping-in", "light-rain", ["minutes", 15]]],
+
+
+
+
+  "Tugev lörtsisadu algab 20 min. pärast, lõppeb 30 min. hiljem.":
+
+    ["sentence",
+
+      ["starting-then-stopping-later",
+
+        "heavy-sleet",
+
+        ["minutes", 20],
+
+        ["minutes", 30]]],
+
+
+
+
+  "Mõõdukas vihmasadu lõppeb 25 min. pärast, algab uuesti 8 min. hiljem.":
+
+    ["sentence",
+
+      ["stopping-then-starting-later",
+
+        "medium-rain",
+
+        ["minutes", 25],
+
+        ["minutes", 8]]],
+
+
+
+
+  "Terve päev on mõõdukas pilvisus.":
+
+    ["sentence", ["for-day", "medium-clouds"]],
+
+
+
+
+  "Nõrk lörtsisadu alates hommikust.":
+
+    ["sentence", ["starting", "very-light-sleet", "morning"]],
+
+
+
+
+  "Mõõdukas tuul kuni ööni.":
+
+    ["sentence", ["until", "medium-wind", "today-night"]],
+
+
+
+
+  "Tugev sadu kuni pärastlõunani.":
+
+    ["sentence", ["until", "heavy-precipitation", "afternoon"]],
+
+
+
+
+  "Kerge tuul pärastlõunal.":
+
+    ["sentence", ["during", "light-wind", "afternoon"]],
+
+
+
+
+  "Mõõdukas lumesadu hiljem õhtul ja homme hommikul.":
+
+    ["sentence", ["during",
+
+      "medium-snow",
+
+      ["and", "later-today-evening", "tomorrow-morning"]]],
+
+
+
+
+  "Tugev vihmasadu hiljem täna hommikul, ja jälle õhtul.":
+
+    ["sentence", ["until-starting-again",
+
+      "heavy-rain",
+
+      "later-today-morning",
+
+      "today-evening"]],
+
+
+
+
+  "Pilves õhtust ööni.":
+
+    ["sentence", ["starting-continuing-until",
+
+      "heavy-clouds",
+
+      "evening",
+
+      "night"]],
+
+
+
+
+  "Kerge lörtsisadu hiljem pärastlõunal ja udu homme hommikul.":
+
+    ["sentence", ["and",
+
+      ["during", "light-sleet", "later-today-afternoon"],
+
+      ["during", "fog", "tomorrow-morning"]]],
+
+
+
+
+  "Tugev tuul hommikust pärastlõunani ja mõõdukas lörtsisadu homme hommikul.":
+
+    ["sentence", ["and",
+
+      ["starting-continuing-until",
+
+        "heavy-wind",
+
+        "today-morning",
+
+        "today-afternoon"],
+
+      ["during", "medium-sleet", "tomorrow-morning"]]],
+
+
+
+
+  "Pilves alates hilisemast ööst ja tugev lumesadu homme pärastlõunal.":
+
+    ["sentence", ["and",
+
+      ["starting", "heavy-clouds", "later-today-night"],
+
+      ["during", "heavy-snow", "tomorrow-afternoon"]]],
+
+
+
+
+  "Kuiv öösel ja kerge sadu homsest õhtust homse ööni.":
+
+    ["sentence", ["and",
+
+      ["during", "low-humidity", "today-night"],
+
+      ["starting-continuing-until",
+
+        "light-precipitation",
+
+        "tomorrow-evening",
+
+        "tomorrow-night"]]],
+
+
+
+
+  "Mõõdukas lumesadu (5 tolli) öösel.":
+
+    ["sentence", ["during",
+
+      ["parenthetical", "medium-snow", ["inches", 5]],
+
+      "night"]],
+
+
+
+
+  "Kerge lumesadu (2 cm) hiljem täna hommikul.":
+
+    ["sentence", ["during",
+
+      ["parenthetical", "light-snow", ["centimeters", 2]],
+
+      "later-today-morning"]],
+
+
+
+
+  "Terve päev on tugev lumesadu (8\u201312 tolli).":
+
+    ["sentence", ["for-day",
+
+      ["parenthetical", "heavy-snow", ["inches", ["range", 8, 12]]]]],
+
+
+
+
+  "Mõõdukas lumesadu (alla 1 cm) pärastlõunal.":
+
+    ["sentence", ["during",
+
+      ["parenthetical", "medium-snow", ["less-than", ["centimeters", 1]]],
+
+      "afternoon"]],
+
+
+
+
+
+
+
+  "Kuiv nädal aega, temperatuur tõuseb homme kuni 85\u00B0F.":
+
+    ["sentence", ["with",
+
+      ["for-week", "no-precipitation"],
+
+      ["temperatures-peaking",
+
+        ["fahrenheit", 85],
+
+        "tomorrow"]]],
+
+
+
+
+  "Erinevad sademed nädalavahetusel, temperatuur tõuseb neljapäeval kuni 32\u00B0C.":
+
+    ["sentence", ["with",
+
+      ["over-weekend", "mixed-precipitation"],
+
+      ["temperatures-rising",
+
+        ["celsius", 32],
+
+        "thursday"]]],
+
+
+
+
+  "Nõrk vihmasadu esmaspäeval, temperatuur langeb reedel kuni 15\u00B0F.":
+
+    ["sentence", ["with",
+
+      ["during", "very-light-rain", "monday"],
+
+      ["temperatures-valleying",
+
+        ["fahrenheit", 15],
+
+        "friday"]]],
+
+
+
+
+  "Kerge lumesadu teisipäeval ja kolmapäeval, temperatuur langeb pühapäeval kuni 0\u00B0C.":
+
+    ["sentence", ["with",
+
+      ["during", "light-snow", ["and", "tuesday", "wednesday"]],
+
+      ["temperatures-falling",
+
+        ["celsius", 0],
+
+        "sunday"]]],
+
+
+
+
+  "Mõõdukas sadu tänasest kuni laupäevani, temperatuur tõuseb esmaspäeval kuni 100\u00B0F.":
+
+    ["sentence", ["with",
+
+      ["during",
+
+        "medium-precipitation",
+
+        ["through", "today", "saturday"]],
+
+      ["temperatures-peaking",
+
+        ["fahrenheit", 100],
+
+        "monday"]]],
+
+
+
+
+  "Terve päev on erinevad sademed (1\u20133 tolli).":
+
+    ["sentence",
+
+      ["for-day",
+
+        ["parenthetical", "mixed-precipitation", ["inches", ["range", 1, 3]]]]],
+
+
+
+
+  "Tugev lumesadu (1\u20133 tolli)":
+
+    ["title", ["parenthetical", "heavy-snow", ["inches", ["range", 1, 3]]]],
+
+
+
+
+  "Tugev lumesadu (3\u20135 cm)":
+
+    ["title", ["parenthetical", "heavy-snow", ["centimeters", ["range", 3, 5]]]]
+
+}
+