Proposed fix for trac ticket #17155 - 1.8

This pull request backport the PR #9 to branch 1.8 (diff at lines 216-218)

##### From PR #9 : #####
This is a two parts fix, one in dojo/i18n, one in util/build/tranforms/writeAMD.

The idea is to gather a list of all available locales in the application at build time, so the i18n plugin can decide of the best available locale without doing any http request.