I'am trying make an Angular multi-language application inside .NET Core 2.1 To serve in others idioms. I use app.Map to run diferents npmScripts in my Startup.cs
app.Map("/fr-FR", spaFr =>
{
spaFr.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.Options.DefaultPage = $"/fr-FR/index.html";
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start:fr");
}
});
});
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.Options.DefaultPage = $"/index.html";
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start");
}
});
So
http://localhost:52337 serve the app in English
http://localhost:52337/fr-FR serve the app in France
But when I write http://localhost:52337/fr-FR the application can not find the bundles files: styles.a006ff9ecb31fc360851.css, runtime.a66f828dca56eeb90e02.js, polyfills.662173b507c7bb60d452.js and main.ddceca57cc95aeab5c91.js
And .NET can not find the files because it are looking for in http://localhost:52337/, but the files are in http://localhost:52337/fr-FR
My package.json has the scripts
"start": "ng serve",
"start:fr": "ng serve --serve-path=/ --base-href=/fr-FR --configuration=fr",
And I've added in the angular.json in configuration
"production-fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"outputPath": "dist/fr-FR/",
"i18nFile": "src/i18n/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
},
"fr": {
"aot": true,
"outputHashing": "all",
"serve-path":"/fr-FR/",
"i18nFile": "src/i18n/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
}
I think that I made all the possibles combinations in scripts, with or wihout --serve-path, --deploy-url, --base-href ... but I can make this work in development environment. What can happen?