punkave/apostrophe-site — pull request #4 by israelidanny (2014-01-25 03:01:36+00:00)
Title: Integrated i18n module, and added a __() local to be used in templates

This is the first commit towards i18n functionality (via npmjs.org/package/i18n).

i18n is integrated in it's most basic form. English won't be affected. In the apostrophe-sites extend, you can now specify i18n settings that will be passed to the site.

The i18n module is implemented here because it's vital for it to be included before any app.VERB or app.router call takes place (that's why it wouldn't work to put it in aposLocals.js).

To turn the module on, all it takes is to do this in the site config:
```
i18n: {
locales: [ 'en', 'de' ],
cookie: 'apos_language' // not required
}
```

In the views, you can now do the following:
```

{{ __('WEBSITES, NOT COFFEE') }}

```

i18n is pretty auto-magic when it comes to finding those strings. In fact, once a language is enabled, the locales directory under the site root directory will automatically be kept up to date with the strings on the website. (as you add strings to views that are missing, they will be appended to the *.json files.