A JavaScript library useful for compiling i18n translations in a custom language to JavaScript functions.
npm install hablar```
Hello $name, it has been {{formatDate($timeSinceLastVisit, "months"}} since your last visit.
This would roughly translate into the following javascript function:
`js`
function(parameters, functions) {
return 'Hello ' + parameters.name + ', it has been ' + functions'formatDate' + ' since your last visit.';
}
It is worth noting that the actual function generated includes various rules regarding escaping output, that complicates the actual function.
.
If there is 1 item we might want to show You have one item in your basket., and otherwise You have $n items in your basket`.This is supported by adding constraints to the variables, basically allowing a series of if-statements to be generated inside the function.