mashpie/i18n-node — pull request #57 by elisee (2013-04-24 18:15:58+00:00)
Title: Fallback to default locale if it couldn't be read

When translate() is called and the specified locale isn't loaded,
the locale will automatically be read() from disk.

If the locale file doesn't exist and updateFiles is true, then a new
locale will be created using write(). But if updateFiles is false (i.e. in production),
then write() won't do anything.

This means that we end up with locales[local] being undefined and
will crash right afterwards when indexing it.

This commit fixes that by checking if locales[local] is defined after
read() was called and switching to the default locale if it isn't.