Skip to content

Ability to manually specify locale in SSR #29019

Open
@demensky

Description

@demensky

Description

There is no way to specify locale in AngularAppEngine#handle based on Accept-Language, Cookie, etc. The current implementation of AngularAppEngine chooses locale based on URL.

Describe the solution you'd like

Ability to specify an array of locales when calling handle:

 app.use('/**', (req, res, next) => {
   angularApp
-    .handle(req)
+    .handle(req, undefined, { locales: req.acceptsLanguages() })
     .then((response) =>
       response ? writeResponseToNodeResponse(response, res) : next(),
     )

As far as I understand, this will also require removing the locale prefix from <base href="…"/>.

Describe alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/ssrfeatureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions