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

2.0 #165

Merged
4 commits merged into from
Feb 7, 2018
Merged

2.0 #165

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
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"use strict";
const fs = require("fs");
const path = require("path");
const Translation = require("./lib/translation");

for(const pathname of fs.readdirSync(path.join(__dirname, "lib/lang"))) {
const match = /^([^\.].*)\.js$/.exec(pathname);

if(match) {
exports[match[1]] = require("./lib/lang/" + pathname);
exports[match[1]] = new Translation(Object.freeze(require("./lib/lang/" + pathname)));
}
}
16 changes: 6 additions & 10 deletions lib/lang/ar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";

function join(a, b, joiner) {
return (a.slice(0, 4) === "يوم " && b.slice(0, 4) === "يوم " && joiner === " و ")
Expand All @@ -11,8 +12,8 @@ function strip_prefix(period) {
period;
}

module.exports = require("../template")({
"clear": "صافِ",
module.exports = {
"clear": "صافِ",
"no-precipitation": "لا أمطار",
"mixed-precipitation": "هطول أمطار وثلوج",
"possible-very-light-precipitation": "إحتمالية هطول أمطار خفيفة",
Expand Down Expand Up @@ -122,11 +123,6 @@ module.exports = require("../template")({
"temperatures-rising": "درجات حرارة ترتفع حتى $1 $2",
"temperatures-valleying": "انخفاض درجات الحرارة لأدنى مستوى لها عند $1 $2",
"temperatures-falling": "درجات حرارة تنخفض حتى $1 $2",
"title": function(str) {
return str;
},
"sentence": function(str) {
return str;
}

});
"title": "$1",
"sentence": "$1",
};
4 changes: 2 additions & 2 deletions lib/lang/az.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

module.exports = require("../template")({
module.exports = {
"clear": "buludsuz",
"no-precipitation": "yağmursuz",
"mixed-precipitation": "qarışıq yağış",
Expand Down Expand Up @@ -119,4 +119,4 @@ module.exports = require("../template")({

return str;
},
});
};
112 changes: 32 additions & 80 deletions lib/lang/be.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

function join_with_shared_prefix(a, b, joiner) {
var m = a,
i = 0,
Expand All @@ -14,87 +16,37 @@ function join_with_shared_prefix(a, b, joiner) {
return a + joiner + b.slice(i);
}

function time2(time)
{
function time2(time) {
switch(time) {
case "раніцай":
time = "раніцы";
break;
case "днём":
time = "сярэдзіны дня";
break;
case "вечарам":
time = "вечара";
break;
case "ноччу":
time = "ночы";
break;
case "сёння ранкам":
time="сённяшняй раніцы";
break;
case "сёння позняй раніцай":
time="сённяшняй позняй раніцы";
break;
case "сёння днём":
time="сярэдзіны дня";
break;
case "сёння познім днём":
time="сённяшняга позняга дня";
break;
case "сёння ўвечары":
time="сённяшняга вечара";
break;
case "сёння познім вечарам":
time="сённяшняга позняга вечара";
break;
case "сёння ноччу":
time="сённяшняй ночы";
break;
case "сёння позняй ноччу":
time="сённяшняй позняй ночы";
break;
case "заўтра раніцай":
time="заўтрашняй раніцы";
break;
case "заўтра днём":
time="заўтрашняга дня";
break;
case "заўтра ўвечары":
time="заўтрашняга вечара";
break;
case "ўвечары":
time="вечара";
break;
case "заўтра ноччу":
time="заўтрашняй ночы";
break;
case "у нядзелю":
time="нядзелі";
break;
case "у панядзелак":
time="панядзелка";
break;
case "у аўторак":
time="аўторка";
break;
case "у сераду":
time="серады";
break;
case "у чацвер":
time="чацвярга";
break;
case "у пятніцу":
time="пятніцы";
break;
case "у суботу":
time="суботы";
break;
};

return time;
case "раніцай": return "раніцы";
case "днём": return "сярэдзіны дня";
case "вечарам": return "вечара";
case "ноччу": return "ночы";
case "сёння ранкам": return "сённяшняй раніцы";
case "сёння позняй раніцай": return "сённяшняй позняй раніцы";
case "сёння днём": return "сярэдзіны дня";
case "сёння познім днём": return "сённяшняга позняга дня";
case "сёння ўвечары": return "сённяшняга вечара";
case "сёння познім вечарам": return "сённяшняга позняга вечара";
case "сёння ноччу": return "сённяшняй ночы";
case "сёння позняй ноччу": return "сённяшняй позняй ночы";
case "заўтра раніцай": return "заўтрашняй раніцы";
case "заўтра днём": return "заўтрашняга дня";
case "заўтра ўвечары": return "заўтрашняга вечара";
case "ўвечары": return "вечара";
case "заўтра ноччу": return "заўтрашняй ночы";
case "у нядзелю": return "нядзелі";
case "у панядзелак": return "панядзелка";
case "у аўторак": return "аўторка";
case "у сераду": return "серады";
case "у чацвер": return "чацвярга";
case "у пятніцу": return "пятніцы";
case "у суботу": return "суботы";
default: return time;
}
}

module.exports = require("../template")({
module.exports = {
"clear": "ясна",
"no-precipitation": "без ападкаў",
"mixed-precipitation": "змешаныя ападкі",
Expand Down Expand Up @@ -236,5 +188,5 @@ module.exports = require("../template")({
str += ".";

return str;
}
});
},
};
43 changes: 15 additions & 28 deletions lib/lang/bg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

function join_with_shared_prefix(a, b, joiner) {
var m = a,
i = 0,
Expand All @@ -14,35 +16,20 @@ function join_with_shared_prefix(a, b, joiner) {
return a + joiner + b.slice(i);
}

function time2(time)
{
function time2(time) {
switch(time) {
case "в неделя":
time = "неделя";
break;
case "в понеделник":
time = "понеделник";
break;
case "във вторник":
time = "вторник";
break;
case "в сряда":
time = "сряда";
break;
case "в четвъртък":
time = "четвъртък";
break;
case "в петък":
time = "петък";
break;
case "в събота":
time = "събота";
break;
};
return time;
case "в неделя": return "неделя";
case "в понеделник": return "понеделник";
case "във вторник": return "вторник";
case "в сряда": return "сряда";
case "в четвъртък": return "четвъртък";
case "в петък": return "петък";
case "в събота": return "събота";
default: return time;
}
}

module.exports = require("../template")({
module.exports = {
"clear": "ясно",
"no-precipitation": "без превалявания",
"mixed-precipitation": "временни превалявания",
Expand Down Expand Up @@ -180,5 +167,5 @@ module.exports = require("../template")({
str += ".";

return str;
}
});
},
};
33 changes: 8 additions & 25 deletions lib/lang/bs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

function join_with_shared_prefix(a, b, joiner) {
var m = a,
i = 0,
Expand All @@ -14,13 +16,7 @@ function join_with_shared_prefix(a, b, joiner) {
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")({
module.exports = {
"clear": "vedro",
"no-precipitation": "nema padavina",
"mixed-precipitation": "različite padavine",
Expand Down Expand Up @@ -115,16 +111,9 @@ module.exports = require("../template")({
"stopping-then-starting-later": "$1 prekida za $2, ondak počinje za $3",
"for-day": "$1 tokom cijelog dana",
"starting": "$1 počinje $2",
"until": function(condition, period) {
return condition + " do " + strip_prefix(period);
},
"until-starting-again": function(condition, a, b) {
return condition + " do " + strip_prefix(a) + ", i opet poćinje " + b;
},
"starting-continuing-until": function(condition, a, b) {
return condition + " poćinje " + a + ", ostaje do " +
strip_prefix(b);
},
"until": "$1 do $2",
"until-starting-again": "$1 do $2, i opet poćinje $3",
"starting-continuing-until": "$1 poćinje $2, ostaje do $3",
"during": "$1 $2",
"for-week": "$1 tokom sedmice",
"over-weekend": "$1 tokom vikenda",
Expand All @@ -137,12 +126,6 @@ module.exports = require("../template")({
* rules, but it is adequate for the purposes of this module.) */
"title": function(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
/*return str.replace(
/\b(?:a(?!nd\b)|[^\Wa])/g,
function(letter) {
return letter.toUpperCase();
}
);*/
},
/* Capitalize the first word of the sentence and end with a period. */
"sentence": function(str) {
Expand All @@ -154,5 +137,5 @@ module.exports = require("../template")({
str += ".";

return str;
}
});
},
};
27 changes: 8 additions & 19 deletions lib/lang/ca.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

function join_with_shared_prefix(a, b, joiner) {
var m = a,
i = 0,
Expand All @@ -14,13 +16,7 @@ function join_with_shared_prefix(a, b, joiner) {
return a + joiner + b.slice(i);
}

function strip_prefix(period) {
return period.slice(0, 9) === "durant la nit" ? period.slice(4) :
period.slice(0, 7) === "a la " ? period.slice(7) :
period;
}

module.exports = require("../template")({
module.exports = {
"clear": "clar",
"no-precipitation": "sense precipitacions",
"mixed-precipitation": "precipitacions mixtes",
Expand Down Expand Up @@ -117,16 +113,9 @@ module.exports = require("../template")({
"stopping-then-starting-later": "$1 parant d'aquí $2, tornant a començar al cap $3",
"for-day": "$1 durant el dia",
"starting": "$1 començant $2",
"until": function(condition, period) {
return condition + " " + strip_prefix(period);
},
"until-starting-again": function(condition, a, b) {
return condition + " " + strip_prefix(a) + ", començant " + b;
},
"starting-continuing-until": function(condition, a, b) {
return condition + " començant " + a + ", continuant " +
strip_prefix(b);
},
"until": "$1 $2",
"until-starting-again": "$1 $2, començant $3",
"starting-continuing-until": "$1 començant $2, continuant $3",
"during": "$1 $2",
"for-week": "$1 durant la setmana",
"over-weekend": "$1 cap al cap de setmana",
Expand All @@ -152,5 +141,5 @@ module.exports = require("../template")({
str += ".";

return str;
}
});
},
};
Loading