Tagged: angular iis i18n
- This topic has 3 replies, 3 voices, and was last updated 4 years, 9 months ago by
Brian Fernandes.
-
AuthorPosts
-
knowledgeplacesParticipantI am developing an Angular 10 app with i18n support, and I want to deploy this app on Microsoft IIS in french on https://mydomain.com/admin/fr and in english on https://mydomain.com/admin/en-US
In file “index.html”, I have set : <base href=”/admin”>
In file “angular.json”, I have added :
“i18n”: {
“sourceLocale”: “en-US”,
“locales”: {
“fr”: {
“translation”: “src/locale/messages.fr.xlf”
}
}
},In environment files, I have added : baseHref: ‘/admin’
When I compile with option : “localize”: [“fr”] in file “angular.json”, I get a working french app on my dev server at https://localhost:4200/admin
When I compile with option : “localize”: [“en-US”] in file “angular.json”, I get a working english app on my dev server at https://localhost:4200/admin
I have read the Angular doc at https://angular.io/guide/i18n#deploy-locales and https://angular.io/guide/deployment#server-configuration to understand how to deploy in production on IIS.
I have set the rewrite rules as mentioned, set “localize”: true in file “angular.json” to get all the localized apps in one build, and, as I am developing in MyEclipse on Windows, I run the build with the command:
MSYS_NO_PATHCONV=1 node_modules/.bin/ng build –prod –base-href “/admin/”The “fr” and the “en-US” folders get well generated in the “dist” folder, and I copy them under the “admin” folder of my IIS web site.
When I go to https://mydomain.com/admin/fr, I get this error in browser console: Error: Cannot match any routes. URL Segment: ‘fr’
When I go to https://mydomain.com/admin/en-US, I get the same error in browser console: Error: Cannot match any routes. URL Segment: ‘en-US’
I did not find any valuable information to solve this in Angular doc or by googling few hours, so any help will be really appreciated.
September 8, 2020 at 9:40 am #662797
Salvador CabreraMemberHi,
Have you tried navigating to another routes? Do they work?
Looks you might need to tweak rewrite rules of IIS.
Try asking on https://gitter.im/angular/angular, the community might have a better idea.Cheers,
SalSeptember 10, 2020 at 5:07 am #662924
knowledgeplacesParticipantI finally did it and this is how to proceed if someone else has same need:
-
This reply was modified 4 years, 9 months ago by
knowledgeplaces.
September 10, 2020 at 5:59 am #662928
Brian FernandesModeratorAppreciate you posting the solution here for everyone, thanks!
-
This reply was modified 4 years, 9 months ago by
-
AuthorPosts