angular-translate/angular-translate — pull request #852 by Zertz (2014-12-10 19:28:13+00:00)
Title: Support for multiple static files

I added support for loading multiple files from different locations by passing a `files` key containing an array of objects.

I reused the previous code, wrapping it in a `load(file)` function. In order to remain BC while keeping code simple, if only an object is passed, it is inserted into the `files` array. Then, it loops through every file and waits for all promises to resolve before merging the returned data into a single object.

Since files are requested asynchronously and then merged, duplicate keys will be overwritten in an unpredictable manner.

**Examples**

*Single file*

$translateProvider
.useStaticFilesLoader({
prefix: '/path/to/locales/',
suffix: '.json'
});

*Multiple files*

$translateProvider
.useStaticFilesLoader({
files: [{
prefix: '/path/to/locales/',
suffix: '.json'
}, {
prefix: 'relative/path/to/locales/',
suffix: ''
}, {
prefix: '/another/path/to/locales/',
suffix: '.json'
}]
});

Perhaps this can be improved, but the downside is that the minified script goes from 616 bytes 997 bytes, *a 60% increase*.

Again, **this change is BC**.

Questions? Comments?