facebook

build and deploy angular app from MyEclipse to Microsoft IIS with i18n support

  1. CodeMix & Angular IDE
  2.  > 
  3. Getting Help
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #662723 Reply

    knowledgeplaces
    Participant

    I 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.

    #662797 Reply

    Hi,

    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,
    Sal

    #662924 Reply

    knowledgeplaces
    Participant

    I finally did it and this is how to proceed if someone else has same need:

    #662928 Reply

    Brian Fernandes
    Moderator

    Appreciate you posting the solution here for everyone, thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: build and deploy angular app from MyEclipse to Microsoft IIS with i18n support

You must be logged in to post in the forum log in