My main.ts file currently has the following code snippet:
declare const require;
const translations = require("raw-loader!./locale/messages.de.xlf");
platformBrowserDynamic().bootstrapModule(AppModule, {
providers: [
{ provide: TRANSLATIONS, useValue: translations },
{ provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
]
});
I am looking to dynamically retrieve the translation string instead of hardcoding it as
"raw-loader!./locale/messages.de.xlf"
. My idea is to utilize a service that provides this string, like so:
const translations = require(translationService.localeString); //this method doesn't work!
Can anyone suggest a solution for this? I have already developed a service for this purpose but I'm not sure how to inject it into the main.ts file.