Skip to content

Esbuilder cannot localize 3rd party components #26350

Open

Description

@destus90

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

I am start using the new angular builder and stuck with localizing an app. The texts are stayed in a source locale and the corresponding LOCALE_ID is not provided.

Minimal Reproduction

  1. git clone https://github.com/destus90/angular-esbuilder-kendo-localization
  2. npm install
  3. npm run start:fr
  4. Observe browser's console (the provided LOCALE_ID is 'en-US') and the texts are not translated into French

Exception or Error

No response

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.0.0
Node: 20.7.0
Package Manager: npm 10.1.0
OS: win32 x64

Angular: 17.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0
@angular-devkit/build-angular   17.0.0
@angular-devkit/core            17.0.0
@angular-devkit/schematics      17.0.0
@schematics/angular             17.0.0
rxjs                            7.8.1
typescript                      4.9.5
zone.js                         0.14.2

Anything else relevant?

No response

Activity

  1. added
    freq1: low
    and removed on Nov 24, 2023
  2. added
    freq1: low
    and removed
    freq1: low
    on Feb 23, 2024
  3. dombioinfo commented on Feb 25, 2025

    @dombioinfo

    Hi,

    I encountered the same issue and I use angular 18. While this issue is not fixed, is there a way to avoid it ?
    (In my case, the third library is kendoui).

  4. gabrielcs23 commented on Jun 24, 2025

    @gabrielcs23

    I encountered the same issue when using Kendo UI as a third-party library, this time with Angular 19.

    I forked @destus90’s repository to update Angular to v19 and Kendo UI to the version my team is currently using. Experimenting with angular.json led to two different scenarios regarding the optimization configuration:

    First Scenario: optimization disabled in development (default)

    When running ng serve --configuration=fr (or npm run start:fr), I confirmed that LOCALE_ID was indeed set to 'fr', but the translation file was not loaded and the texts remained in English. Bundle generation time was around 4 seconds.

    Second Scenario: optimization enabled in development (current fork state)

    Repository: https://github.com/gabrielcs23/angular-esbuilder-kendo-localization

    Enabling optimization (somehow) caused the texts to be translated correctly. I have no idea why this setting makes a difference for loading translations and would like very much to understand so, as I don’t fully understand the underlying cause. However, the side effects were:

    • Prebundling could not be used (CLI warns: “Prebundling has been configured but will not be used because scripts optimization is enabled.”).
    • Bundle generation time increased from ~4 seconds to ~10 seconds on a minimal application.

    CLI log excerpt:

    > [email protected] start:fr
    > ng serve --configuration=fr
    
    Prebundling has been configured but will not be used because scripts optimization is enabled.
    ...
    Application bundle generation complete. [10.819 seconds]

    Note that the project builder is @angular-devkit/build-angular:application. On the other hand, it is possible to get everything working as expected when optimization is disabled, but only if using the browser builder instead.

    My team and I would prefer to stick with Vite + esbuilder if possible. Any guidance on how to get i18n working with optimization enabled (or how to improve performance when optimization is on) would be greatly appreciated.

  5. sroucheray commented on Sep 3, 2026

    @sroucheray

    Any update on this? I encountered the problem when trying to localize the ngx-bootstrap datepicker using LOCALE_ID. It worked well previously but stopped working as soon as we switched to @angular-devkit/build-angular:browser-esbuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions