Skip to content

Dynamicly import and locale angular13 #44188

Closed
@ybarbaria

Description

@ybarbaria

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes

Description

I moved from angular 12 to angular 13 and I've had a new error. So basically I used to load the culture of the user by importing the locale file.
"Cannot find module '@angular/common/locales/fr.js'"
I used to import the locale dynamicly by getting the language of the brower.

const localeUri =@angular/common/locales/${localeId}.js; return import(localeUri).then((module) => { logger.debug("Culture Angular : '" + localeId + "'"); registerLocaleData(module.default); }).catch((err) => { logger.fatal("culture not defined for angular", err); });

But I can't do that anymore with angular13.
I try to find any information in your doc but couldn't find anything...

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Cannot find module '@angular/common/locales/fr.js'

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 13.0.2
Node: 14.18.0
Package Manager: npm 6.14.15
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.2
@angular-devkit/build-angular   13.0.2
@angular-devkit/core            13.0.2
@angular-devkit/schematics      13.0.2
@angular/cli                    13.0.2
@schematics/angular             13.0.2
rxjs                            6.6.7
typescript                      4.4.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions