SlexAxton/messageformat.js — pull request #32 by eemeli (2014-02-06 11:14:47+00:00)
Title: Simpler output for simple messageFormatPattern cases

messageformat.js is pretty much exactly what I need for a project I'm looking to internationalize, thank you!

Looking at the [sample code](https://github.com/SlexAxton/messageformat.js/blob/master/example/en/i18n.js) I was struck by some of the unnecessary code that's generated by `precompile()` for the simplest cases.

This fixes those cases, by replacing for example:
```js
window.i18n["colors"]["red"] = function(d){
var r = "";
r += "red";
return r;
}
```
With:
```js
window.i18n["colors"]["red"] = function(d){return "red";}
```

In terms of file size, this saves around 10% for the sample files; a saving that appears to persist through minification.