Closed Sandeep321 closed 6 years ago
Can I write something lime :
return new MultiTranslateHttpLoader(httpClient, [
{prefix: "./assets/translate/core/*.", suffix: ".json"}
]);
which would match all en files for en language.
e.g - messages-headers.en.json
messages-headers.en-UK.json
messages-details.en.json
messages-details.en-US.json
You can use this:
export function HttpLoaderFactory(httpClient: HttpClient) {
return new MultiTranslateHttpLoader(httpClient, [
{prefix: "./assets/translate/core/messages-headers.", suffix: ".json"},
{prefix: "./assets/translate/core/messages-details.", suffix: ".json"},
]);
}
Note that you have to write the name of each file there. You cannot just use {prefix: "./assets/translate/core/*.", suffix: ".json"}
because the client on which this code runs does not know which translation files are on the server. You would need to concatenate all translation files for each language in the build process. Something like this https://github.com/ngx-translate/http-loader#angular-cliwebpack-translateloader-example with deep-merge.
That's what I am doing now. Thanks for the reconfirming. Closing the issue then.
What I am looking for is that I would want to divide the translation files into smaller ones, keeping all the translation files in the same directory. So, instead of using something like core and shared folders, Can we load all the translation files for the same language from the current folder.
It might be possible that I have files names like:
messages-header-en.json
messages-details-en.json