Repository: darkskyapp/forecast-io-translations
Pull request #71 (2016-04-18 00:10:13)

Add new indonesian translation
Add new Indonesian translation


Patch:
diff --git a/.gitignore b/.gitignore
index 37a6e2b..7ff92de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
 *.log
 node_modules
 build
+.DS_Store
\ No newline at end of file
diff --git a/lib/lang/id.js b/lib/lang/id.js
new file mode 100644
index 0000000..3f0fed8
--- /dev/null
+++ b/lib/lang/id.js
@@ -0,0 +1,153 @@
+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);
+}
+
+function strip_prefix(period) {
+  return period.slice(0, 9) === "overnight" ? period.slice(4) :
+         period.slice(0, 7) ===   "in the " ? period.slice(7) :
+                                              period;
+}
+
+module.exports = require("../template")({
+  "clear": "cerah",
+  "no-precipitation": "tidak hujan",
+  "mixed-precipitation": "hujan ringan",
+  "possible-very-light-precipitation": "kemungkinan hujan ringan",
+  "very-light-precipitation": "hujan ringan",
+  "possible-light-precipitation": "kemungkinan hujan ringan",
+  "light-precipitation": "hujan ringan",
+  "medium-precipitation": "hujan",
+  "heavy-precipitation": "hujan lebat",
+  "possible-very-light-rain": "kemungkinan hujan ringan",
+  "very-light-rain": "hujan ringan",
+  "possible-light-rain": "kemungkinan hujan ringan",
+  "light-rain": "hujan ringan",
+  "medium-rain": "hujan",
+  "heavy-rain": "hujan lebat",
+  "possible-very-light-sleet": "kemungkinan hujan salju",
+  "very-light-sleet": "hujan salju ringan",
+  "possible-light-sleet": "kemungkinan hujan salju ringan",
+  "light-sleet": "hujan salju ringan",
+  "medium-sleet": "hujan salju",
+  "heavy-sleet": "hujan salju lebat",
+  "possible-very-light-snow": "kemungkinan saju ringan",
+  "very-light-snow": "salju ringan",
+  "possible-light-snow": "kemungkinan salju ringan",
+  "light-snow": "salju ringan",
+  "medium-snow": "salju",
+  "heavy-snow": "salju besar",
+  "light-wind": "berangin ringan",
+  "medium-wind": "berangin",
+  "heavy-wind": "berangin besar",
+  "low-humidity": "kering",
+  "high-humidity": "lembab",
+  "fog": "berkabut",
+  "light-clouds": "sedikit berawan",
+  "medium-clouds": "berawan",
+  "heavy-clouds": "berawan besar",
+  "today-morning": "pagi ini",
+  "later-today-morning": "nanti pagi ini",
+  "today-afternoon": "sore ini",
+  "later-today-afternoon": "nanti sore ini",
+  "today-evening": "malam ini",
+  "later-today-evening": "nanti malam ini",
+  "today-night": "malam ini",
+  "later-today-night": "nanti malam ini",
+  "tomorrow-morning": "besok pagi",
+  "tomorrow-afternoon": "besok sore",
+  "tomorrow-evening": "besok malam",
+  "tomorrow-night": "besok tengah malam",
+  "morning": "pada pagi hari",
+  "afternoon": "pada sore hari",
+  "evening": "pada malam hari",
+  "night": "tengah malam",
+  "today": "hari ini",
+  "tomorrow": "besok",
+  "sunday": "pada hari Minggu",
+  "monday": "pada hari Senin",
+  "tuesday": "pada hari Selasa",
+  "wednesday": "pada hari Rabu",
+  "thursday": "pada hari Kamis",
+  "friday": "pada hari Jum'at",
+  "saturday": "pada hari Sabtu",
+  "minutes": "$1 min.",
+  "fahrenheit": "$1\u00B0F",
+  "celsius": "$1\u00B0C",
+  "inches": "$1 in.",
+  "centimeters": "$1 cm.",
+  "less-than": "dibawah $1",
+  "and": function(a, b) {
+    return join_with_shared_prefix(
+      a,
+      b,
+      a.indexOf(",") !== -1 ? ", dan " : " dan "
+    );
+  },
+  "through": function(a, b) {
+    return join_with_shared_prefix(a, b, " melalui ");
+  },
+  "with": "$1, dengan $2",
+  "range": "$1\u2013$2",
+  "parenthetical": function(a, b) {
+    return a + " (" + b + (a === "hujan ringan" ? " oleh salju)" : ")");
+  },
+  "for-hour": "$1 pada jam",
+  "starting-in": "$1 mulai pada $2",
+  "stopping-in": "$1 berhenti pada $2",
+  "starting-then-stopping-later": "$1 mulai pada $2, berhenti $3 nanti",
+  "stopping-then-starting-later": "$1 berhenti pada $2, berhenti lagi $3 nanti",
+  "for-day": "$1 selama sehari",
+  "starting": "$1 mulai $2",
+  "until": function(condition, period) {
+    return condition + " sampai " + strip_prefix(period);
+  },
+  "until-starting-again": function(condition, a, b) {
+    return condition + " sampai " + strip_prefix(a) + ", mulai kembali " + b;
+  },
+  "starting-continuing-until": function(condition, a, b) {
+    return condition + " mulai " + a + ", berlanjut sampai " +
+           strip_prefix(b);
+  },
+  "during": "$1 $2",
+  "for-week": "$1 selama seminggu",
+  "over-weekend": "$1 selama akhir minggu",
+  "temperatures-peaking": "suhu memuncak pada $1 $2",
+  "temperatures-rising": "suhu naik ke $1 $2",
+  "temperatures-valleying": "suhu menurun pada $1 $2",
+  "temperatures-falling": "suhu turun pada $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(
+      /\b(?:a(?!nd\b)|c(?!m\.)|i(?!n\.)|[^\Waci])/g,
+      function(letter) {
+        return letter.toUpperCase();
+      }
+    );
+  },
+  /* 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;
+  }
+});


Test patch:
diff --git a/test_cases/id.json b/test_cases/id.json
new file mode 100644
index 0000000..e6e7fd7
--- /dev/null
+++ b/test_cases/id.json
@@ -0,0 +1,251 @@
+{
+  "Cerah":
+    ["title", "clear"],
+
+  "Kemungkinan Hujan Ringan":
+    ["title", "possible-very-light-precipitation"],
+
+  "Hujan Ringan":
+    ["title", "very-light-precipitation"],
+
+  "Kemungkinan Hujan Ringan":
+    ["title", "possible-light-precipitation"],
+
+  "Hujan Ringan":
+    ["title", "light-precipitation"],
+
+  "Hujan":
+    ["title", "medium-precipitation"],
+
+  "Hujan Lebat":
+    ["title", "heavy-precipitation"],
+
+  "Kemungkinan Hujan Ringan":
+    ["title", "possible-very-light-rain"],
+
+  "Hujan Ringan":
+    ["title", "very-light-rain"],
+
+  "Kemungkinan Hujan Ringan":
+    ["title", "possible-light-rain"],
+
+  "Hujan Ringan":
+    ["title", "light-rain"],
+
+  "Hujan":
+    ["title", "medium-rain"],
+
+  "Hujan Lebat":
+    ["title", "heavy-rain"],
+
+  "Kemungkinan Hujan Salju Ringan":
+    ["title", "possible-very-light-sleet"],
+
+  "Hujan Salju Ringan":
+    ["title", "very-light-sleet"],
+
+  "Kemungkinan Hujan Salju Ringan":
+    ["title", "possible-light-sleet"],
+
+  "Hujan Salju Ringan":
+    ["title", "light-sleet"],
+
+  "Hujan Salju":
+    ["title", "medium-sleet"],
+
+  "Hujan Salju Lebat":
+    ["title", "heavy-sleet"],
+
+  "Kemungkinan Salju Ringan":
+    ["title", "possible-very-light-snow"],
+
+  "Salju Ringan":
+    ["title", "very-light-snow"],
+
+  "Kemungkinan Salju Ringan":
+    ["title", "possible-light-snow"],
+
+  "Salju Ringan":
+    ["title", "light-snow"],
+
+  "Salju":
+    ["title", "medium-snow"],
+
+  "Salju Besar":
+    ["title", "heavy-snow"],
+
+  "Berangin":
+    ["title", "medium-wind"],
+
+  "Berangin Besar":
+    ["title", "heavy-wind"],
+
+  "Berkabut":
+    ["title", "fog"],
+
+  "Berawan":
+    ["title", "medium-clouds"],
+
+  "Berawan Besar":
+    ["title", "heavy-clouds"],
+
+  "Kering Dan Berangin Ringan":
+    ["title", ["and", "low-humidity", "light-wind"]],
+
+  "Hujan Ringan Dan Berangin Besar":
+    ["title", ["and", "very-light-rain", "heavy-wind"]],
+
+  "Lembab Dan Sedikit Berawan":
+    ["title", ["and", "high-humidity", "light-clouds"]],
+
+
+  "Cerah pada jam.":
+    ["sentence", ["for-hour", "clear"]],
+
+  "Salju ringan mulai pada 35 min.":
+    ["sentence", ["starting-in", "very-light-snow", ["minutes", 35]]],
+
+  "Hujan ringan berhenti pada 15 min.":
+    ["sentence", ["stopping-in", "light-rain", ["minutes", 15]]],
+
+  "Hujan salju lebat mulai pada 20 min., berhenti 30 min. nanti.":
+    ["sentence",
+      ["starting-then-stopping-later",
+        "heavy-sleet",
+        ["minutes", 20],
+        ["minutes", 30]]],
+
+  "Hujan berhenti pada 25 min., berhenti lagi 8 min. nanti.":
+    ["sentence",
+      ["stopping-then-starting-later",
+        "medium-rain",
+        ["minutes", 25],
+        ["minutes", 8]]],
+
+
+  "Berawan selama sehari.":
+    ["sentence", ["for-day", "medium-clouds"]],
+
+  "Hujan salju ringan mulai pada pagi hari.":
+    ["sentence", ["starting", "very-light-sleet", "morning"]],
+
+  "Berangin sampai malam ini.":
+    ["sentence", ["until", "medium-wind", "today-night"]],
+
+  "Hujan lebat sampai pada sore hari.":
+    ["sentence", ["until", "heavy-precipitation", "afternoon"]],
+
+  "Berangin ringan pada sore hari.":
+    ["sentence", ["during", "light-wind", "afternoon"]],
+
+  "Salju nanti malam ini dan besok pagi.":
+    ["sentence", ["during",
+      "medium-snow",
+      ["and", "later-today-evening", "tomorrow-morning"]]],
+
+  "Hujan lebat sampai nanti pagi ini, mulai kembali malam ini.":
+    ["sentence", ["until-starting-again",
+      "heavy-rain",
+      "later-today-morning",
+      "today-evening"]],
+
+  "Berawan besar mulai pada malam hari, berlanjut sampai tengah malam.":
+    ["sentence", ["starting-continuing-until",
+      "heavy-clouds",
+      "evening",
+      "night"]],
+
+  "Hujan salju ringan nanti sore ini dan berkabut besok pagi.":
+    ["sentence", ["and",
+      ["during", "light-sleet", "later-today-afternoon"],
+      ["during", "fog", "tomorrow-morning"]]],
+
+  "Berangin besar mulai pagi ini, berlanjut sampai sore ini, dan hujan salju besok pagi.":
+    ["sentence", ["and",
+      ["starting-continuing-until",
+        "heavy-wind",
+        "today-morning",
+        "today-afternoon"],
+      ["during", "medium-sleet", "tomorrow-morning"]]],
+
+  "Berawan besar mulai nanti malam ini dan salju besar besok sore.":
+    ["sentence", ["and",
+      ["starting", "heavy-clouds", "later-today-night"],
+      ["during", "heavy-snow", "tomorrow-afternoon"]]],
+
+  "Kering malam ini dan hujan ringan mulai besok malam, berlanjut sampai besok tengah malam.":
+    ["sentence", ["and",
+      ["during", "low-humidity", "today-night"],
+      ["starting-continuing-until",
+        "light-precipitation",
+        "tomorrow-evening",
+        "tomorrow-night"]]],
+
+  "Salju (5 in.) tengah malam.":
+    ["sentence", ["during",
+      ["parenthetical", "medium-snow", ["inches", 5]],
+      "night"]],
+
+  "Salju ringan (2 cm.) nanti pagi ini.":
+    ["sentence", ["during",
+      ["parenthetical", "light-snow", ["centimeters", 2]],
+      "later-today-morning"]],
+
+  "Salju besar (8\u201312 in.) selama sehari.":
+    ["sentence", ["for-day",
+      ["parenthetical", "heavy-snow", ["inches", ["range", 8, 12]]]]],
+
+  "Salju (dibawah 1 cm.) pada sore hari.":
+    ["sentence", ["during",
+      ["parenthetical", "medium-snow", ["less-than", ["centimeters", 1]]],
+      "afternoon"]],
+
+
+  "Tidak hujan selama seminggu, dengan suhu memuncak pada 85\u00B0F besok.":
+    ["sentence", ["with",
+      ["for-week", "no-precipitation"],
+      ["temperatures-peaking",
+        ["fahrenheit", 85],
+        "tomorrow"]]],
+
+  "Hujan ringan selama akhir minggu, dengan suhu naik ke 32\u00B0C pada hari Kamis.":
+    ["sentence", ["with",
+      ["over-weekend", "mixed-precipitation"],
+      ["temperatures-rising",
+        ["celsius", 32],
+        "thursday"]]],
+
+  "Hujan ringan pada hari Senin, dengan suhu menurun pada 15\u00B0F pada hari Jum'at.":
+    ["sentence", ["with",
+      ["during", "very-light-rain", "monday"],
+      ["temperatures-valleying",
+        ["fahrenheit", 15],
+        "friday"]]],
+
+  "Salju ringan pada hari Selasa dan Rabu, dengan suhu turun pada 0\u00B0C pada hari Minggu.":
+    ["sentence", ["with",
+      ["during", "light-snow", ["and", "tuesday", "wednesday"]],
+      ["temperatures-falling",
+        ["celsius", 0],
+        "sunday"]]],
+
+  "Hujan hari ini melalui pada hari Sabtu, dengan suhu memuncak pada 100\u00B0F pada hari Senin.":
+    ["sentence", ["with",
+      ["during",
+        "medium-precipitation",
+        ["through", "today", "saturday"]],
+      ["temperatures-peaking",
+        ["fahrenheit", 100],
+        "monday"]]],
+
+  "Hujan ringan (1\u20133 in. oleh salju) selama sehari.":
+    ["sentence",
+      ["for-day",
+        ["parenthetical", "mixed-precipitation", ["inches", ["range", 1, 3]]]]],
+
+  "Salju Besar (1\u20133 in.)":
+    ["title", ["parenthetical", "heavy-snow", ["inches", ["range", 1, 3]]]],
+
+  "Salju Besar (3\u20135 cm.)":
+    ["title", ["parenthetical", "heavy-snow", ["centimeters", ["range", 3, 5]]]]
+}