angular/angular-cli

[EsBuild] locale changed from "en" to "en-US" on server side (ng serve)

manzonif opened this issue · 5 comments

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

In Angular 18, when I run ng serve with ssr true, the LOCALE_ID is 'en-US' server side, 'en' client side. ("sourceLocale": "en" and "localize": ["en"]).
May be related to #26409
Screenshot 2024-05-03 013821

Minimal Reproduction

Start an angular app with i18n, "sourceLocale": "en", "localize": ["en"] or "localize": false, ssr: true, ng serve. Inspect LOCALE_ID.

Exception or Error

No response

Your Environment

Angular CLI: 18.0.0-next.5
Node: 20.11.1
Package Manager: yarn 1.22.21
OS: win32 x64

Angular: 18.0.0-next.6
... animations, cdk, common, compiler, compiler-cli, core, forms
... google-maps, language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1800.0-next.5
@angular-devkit/build-angular     18.0.0-next.5
@angular-devkit/build-optimizer   0.1302.1
@angular-devkit/core              18.0.0-next.5
@angular-devkit/schematics        17.1.2
@angular/cli                      18.0.0-next.5
@angular/material                 18.0.0-next.5
@angular/ssr                      18.0.0-next.5
@schematics/angular               18.0.0-next.5
rxjs                              7.8.1
typescript                        5.4.5
zone.js                           0.14.4

Anything else relevant?

No response

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

I tried the repro-app, but it work correctly. Basically the difference is here:
My app, (It comes form Angular 4, so I have app.module and polifylls.ts, not the app.config.ts )

Screenshot 2024-05-03 134936

repro app
Screenshot 2024-05-03 133322

@manzonif, unfortunately without a reproduction it's impossible for us to investigate and solve the problem.

@alan-agius4 Thanks for the reply. In the end, I opted to migrate the application to standalone, and now it works fine.