Skip to content

Commit

Permalink
Just a little optimization and style consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
J. T. L committed Aug 19, 2013
1 parent 111c79c commit 2fe1363
Showing 1 changed file with 43 additions and 53 deletions.
96 changes: 43 additions & 53 deletions lib/lang/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,12 @@ function join_with_shared_prefix(a, b, joiner) {
return a.slice(0, i) + a.slice(i) + 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;
function today_variants(scope, a, b){
return scope.indexOf("starting-continuing-until") !== -1 ? a : b;
}

function todayVariants(scope, theArgs){
if (scope.indexOf('starting-continuing-until')>0){
return theArgs[0]
}
return theArgs[1]
}

function weekDays(scope, theArgs){
if (scope.indexOf('through')>0){
return "van "+theArgs[0]
}
return "op "+ theArgs[0]
function weekdays(scope, day){
return (scope.indexOf("through") !== -1 ? "van " : "op ") + day;
}

module.exports = require("../template")({
Expand Down Expand Up @@ -58,13 +46,21 @@ module.exports = require("../template")({
"light-clouds": "licht bewolkt",
"medium-clouds": "overwegend bewolkt",
"heavy-clouds": "zwaar bewolkt",
"today-morning": function(){return todayVariants(this, ["de ochtend","vanochtend"])},
"today-morning": function() {
return today_variants(this, "de ochtend", "vanochtend");
},
"later-today-morning": "later vanochtend",
"today-afternoon": function(){return todayVariants(this, ["de middag","vanmiddag"])},
"today-afternoon": function() {
return today_variants(this, "de middag", "vanmiddag");
},
"later-today-afternoon": "later vanmiddag",
"today-evening": function(){return todayVariants(this, ["de avond","vanavond"])},
"today-evening": function() {
return today_variants(this, "de avond", "vanavond");
},
"later-today-evening": "later vanavond",
"today-night": function(){return todayVariants(this, ["de nacht","vannacht"])},
"today-night": function() {
return today_variants(this, "de nacht", "vannacht");
},
"later-today-night": "later vannacht",
"tomorrow-morning": "morgenochtend",
"tomorrow-afternoon": "morgenmiddag",
Expand All @@ -77,12 +73,12 @@ module.exports = require("../template")({
"today": "vandaag",
"tomorrow": "morgen",
"sunday": "op zondag",
"monday": function(){return weekDays(this, ["maandag"])},
"tuesday": function(){return weekDays(this, ["dinsdag"])},
"wednesday":function(){return weekDays(this, ["woensdag"])},
"thursday": function(){return weekDays(this, ["donderdag"])},
"friday": function(){return weekDays(this, ["vrijdag"])},
"saturday": function(){return weekDays(this, ["zaterdag"])},
"monday": function(){ return weekdays(this, "maandag"); },
"tuesday": function(){ return weekdays(this, "dinsdag"); },
"wednesday":function(){ return weekdays(this, "woensdag"); },
"thursday": function(){ return weekdays(this, "donderdag"); },
"friday": function(){ return weekdays(this, "vrijdag"); },
"saturday": function(){ return weekdays(this, "zaterdag"); },
"minutes": "$1 min.",
"fahrenheit": "$1\u00B0F",
"celsius": "$1\u00B0C",
Expand All @@ -109,34 +105,28 @@ module.exports = require("../template")({
"stopping-then-starting-later": "$1 stopt over $2 maar begint $3 later opnieuw",
"for-day": "$1 gedurende de dag",
"starting": function(condition, time) {
if (this[1]=='starting'){
return "In "+time + " " +condition
}else if (this[1]=='and'){
return time + " " + condition;
}else{
return condition + " " + time;
}
},
"until": function(condition, period) {
return condition + " tot " + strip_prefix(period);
},
"until-starting-again": function(condition, a, b) {
return condition + " tot " + strip_prefix(a) + " en "+ b + " weer opnieuw";
},
"starting-continuing-until": function(condition, a, b) {
return condition + " vanaf " + a + " dat door blijft gaan tot " +
strip_prefix(b);
if(this[1] === "starting")
return "in " + time + " " + condition;

else if(this[1] === "and")
return time + " " + condition;

else
return condition + " " + time;
},
"until": "$1 tot $2",
"until-starting-again": "$1 tot $2 en $3 weer opnieuw",
"starting-continuing-until": "$1 vanaf $2 dat door blijft gaan tot $3",
"during": function(condition, time) {
if (this[1]=='and'){
return time + " " +condition
}else if(this[1]=='with'){
condition + " " + time;
}else{
return condition + " gedurende " + time
}
return condition + " " + time;
},
if(this[1] === "and")
return time + " " + condition;

else if(this[1] === "with")
return condition + " " + time;

else
return condition + " gedurende " + time;
},
"for-week": "de hele week $1",
"over-weekend": "$1 dit weekend",
"temperatures-peaking": "een maximum temperatuur van $1 $2",
Expand All @@ -147,7 +137,7 @@ module.exports = require("../template")({
* "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.charAt(0).toUpperCase() + str.slice(1);
return str.charAt(0).toUpperCase() + str.slice(1);
},
/* Capitalize the first word of the sentence and end with a period. */
"sentence": function(str) {
Expand Down

0 comments on commit 2fe1363

Please sign in to comment.