airbnb/polyglot.js — pull request #3 by ziad-saab (2013-05-01 20:12:46+00:00)
Title: Provide support for a default language

For the use case where most of the users of a given application have the same language, allow polyglot to fall back on using the key as the actual translation.

The current code does return the key, but in case the key contains an interpolation or a plural it will not be taken into account.

This change not only removes the necessity for having a JSON for your most popular language, but also makes it easier to translate your app to other languages:

1. Write your HTML templates using, e.g.:
```
{{polyglot.t('Welcome %{name}', {name: name})}}
```
2. If your user's preferred language is English, initialize an empty `new Polyglot()`, and everything works as expected
3. Parse your templates for calls to `polyglot.t` and generate an empty JSON for the new language you are ready to translate
4. The phrases to translate are more explicit because the keys in your JSON correspond to the actual English phrase