Angular-cli: Error: Missing locale data for the locale "fr".

Created on 11 Nov 2017  路  6Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ X ] bug report
- [ ] feature request

Saw issue #6683 but it does not solve my problem

Versions.

Angular CLI: 1.5.0
Node: 6.11.5
OS: linux x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular/platform-server: 4.3.6
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

I upgraded from Angular 4 to 5 and got this error in the browser when using the local FR.
But it works perfectly with EN!

The log given by the failure.

ERROR Error: Missing locale data for the locale "fr".
Stack trace:
findLocaleData@webpack-internal:///../../../common/esm5/common.js:1561:11
getLocaleNumberFormat@webpack-internal:///../../../common/esm5/common.js:1404:33
formatNumber$1@webpack-internal:///../../../common/esm5/common.js:4999:35
DecimalPipe.prototype.transform@webpack-internal:///../../../common/esm5/common.js:6106:18
checkAndUpdatePureExpressionInline@webpack-internal:///../../../core/esm5/core.js:13095:33
checkAndUpdateNodeInline@webpack-internal:///../../../core/esm5/core.js:13798:20
checkAndUpdateNode@webpack-internal:///../../../core/esm5/core.js:13737:16
debugCheckAndUpdateNode@webpack-internal:///../../../core/esm5/core.js:14609:55
debugCheckRenderNodeFn@webpack-internal:///../../../core/esm5/core.js:14588:13
View_ChargersComponent_0/<@ng:///ChargersModule/ChargersComponent.ngfactory.js:350:47
debugUpdateRenderer@webpack-internal:///../../../core/esm5/core.js:14573:12
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13709:5
callViewAction@webpack-internal:///../../../core/esm5/core.js:14054:21
execComponentViewsAction@webpack-internal:///../../../core/esm5/core.js:13986:13
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13710:5
callViewAction@webpack-internal:///../../../core/esm5/core.js:14054:21
execEmbeddedViewsAction@webpack-internal:///../../../core/esm5/core.js:14012:17
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13705:5
callViewAction@webpack-internal:///../../../core/esm5/core.js:14054:21
execComponentViewsAction@webpack-internal:///../../../core/esm5/core.js:13986:13
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13710:5
callViewAction@webpack-internal:///../../../core/esm5/core.js:14054:21
execEmbeddedViewsAction@webpack-internal:///../../../core/esm5/core.js:14012:17
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13705:5
callViewAction@webpack-internal:///../../../core/esm5/core.js:14054:21
execComponentViewsAction@webpack-internal:///../../../core/esm5/core.js:13986:13
checkAndUpdateView@webpack-internal:///../../../core/esm5/core.js:13710:5
callWithDebugContext@webpack-internal:///../../../core/esm5/core.js:14936:39
debugCheckAndUpdateView@webpack-internal:///../../../core/esm5/core.js:14473:12
ViewRef_.prototype.detectChanges@webpack-internal:///../../../core/esm5/core.js:11496:9
ApplicationRef.prototype.tick/<@webpack-internal:///../../../core/esm5/core.js:5982:58
ApplicationRef.prototype.tick@webpack-internal:///../../../core/esm5/core.js:5982:13
next/<@webpack-internal:///../../../core/esm5/core.js:5815:99
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:392:17
onInvoke@webpack-internal:///../../../core/esm5/core.js:4825:24
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:391:17
Zone.prototype.run@webpack-internal:///../../../../zone.js/dist/zone.js:142:24
NgZone.prototype.run@webpack-internal:///../../../core/esm5/core.js:4642:54
next@webpack-internal:///../../../core/esm5/core.js:5815:69
EventEmitter.prototype.subscribe/schedulerFn<@webpack-internal:///../../../core/esm5/core.js:4419:36
SafeSubscriber.prototype.__tryOrUnsub@webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:244:13
SafeSubscriber.prototype.next@webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:191:17
Subscriber.prototype._next@webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:132:9
Subscriber.prototype.next@webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:96:13
Subject.prototype.next@webpack-internal:///../../../../rxjs/_esm5/Subject.js:66:17
EventEmitter.prototype.emit@webpack-internal:///../../../core/esm5/core.js:4399:24
checkStable@webpack-internal:///../../../core/esm5/core.js:4790:13
onHasTask@webpack-internal:///../../../core/esm5/core.js:4838:21
ZoneDelegate.prototype.hasTask@webpack-internal:///../../../../zone.js/dist/zone.js:445:21
ZoneDelegate.prototype._updateTaskCount@webpack-internal:///../../../../zone.js/dist/zone.js:465:17
Zone.prototype._updateTaskCount@webpack-internal:///../../../../zone.js/dist/zone.js:289:17
Zone.prototype.runTask@webpack-internal:///../../../../zone.js/dist/zone.js:209:25
drainMicroTaskQueue@webpack-internal:///../../../../zone.js/dist/zone.js:602:25
ZoneTask.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:503:21
invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:1540:9
globalZoneAwareCallback@webpack-internal:///../../../../zone.js/dist/zone.js:1566:17

Desired functionality.

That the formatting works with local other than EN

Mention any other details that might be useful.

I'm using @ngx-translate/core for the translation service

Most helpful comment

I had the same issue for "da-DK". I found the solution here:
https://github.com/angular/angular/issues/20286

Direct link to docs: https://angular.io/guide/i18n#i18n-pipes

All 6 comments

I had the same issue for "da-DK". I found the solution here:
https://github.com/angular/angular/issues/20286

Direct link to docs: https://angular.io/guide/i18n#i18n-pipes

The CLI will automatically include the relevant data if the locale is specified either in the app鈥檚 TS config or via the command line option.

Thanks all!
Issue solved!

From the docs: https://angular.io/guide/i18n#i18n-pipes

The CLI imports the locale data for you when you use the parameter --locale with ng serve and ng build.

@clydin Does this also apply for platform: server and/or lazy-loaded routes? Cause I'm seeing the same errors when pre-rendering an Angular 5 application (following the config guide for Universal from the cli wiki).

I'm building the Browser version like this:

  • ng build --target=production --environment=dev --progress=true --app=eu-browser --i18nFile=src/app-eu/i18n/messages.de.xlf --i18nFormat=xlf --locale=de

And then building the Server version like this:

  • ng build --target=production --environment=dev --progress=true --app=eu-server --i18nFile=src/app-eu/i18n/messages.de.xlf --i18nFormat=xlf --locale=de --output-hashing=false

And yet I still see similar errors when running my pre-render task.

ERROR Error: Missing locale data for the locale "de".
at findLocaleData ($PROJECT$/dist/server.js:24837:11)
at getLocaleId ($PROJECT$/dist/server.js:24446:12)
at getNamedFormat ($PROJECT$/dist/server.js:27036:37)
at formatDate ($PROJECT$/dist/server.js:26997:40)
at DatePipe.transform ($PROJECT$/dist/server.js:27789:16)
at checkAndUpdatePureExpressionInline ($PROJECT$/dist/server.js:13772:38)
at checkAndUpdateNodeInline ($PROJECT$/dist/server.js:14488:20)
at checkAndUpdateNode ($PROJECT$/dist/server.js:14427:16)
at prodCheckAndUpdateNode ($PROJECT$/dist/server.js:15151:5)
at Object.updateRenderer ($PROJECT$/dist/server.js:135484:199660)
at Object.updateRenderer ($PROJECT$/dist/server.js:14877:29)
at checkAndUpdateView ($PROJECT$/dist/server.js:14398:14)
at callViewAction ($PROJECT$/dist/server.js:14744:21)
at execEmbeddedViewsAction ($PROJECT$/dist/server.js:14702:17)
at checkAndUpdateView ($PROJECT$/dist/server.js:14394:5)
at callViewAction ($PROJECT$/dist/server.js:14744:21)
at execEmbeddedViewsAction ($PROJECT$/dist/server.js:14702:17)
at checkAndUpdateView ($PROJECT$/dist/server.js:14394:5)
at callViewAction ($PROJECT$/dist/server.js:14744:21)
at execEmbeddedViewsAction ($PROJECT$/dist/server.js:14702:17)
at checkAndUpdateView ($PROJECT$/dist/server.js:14394:5)
at callViewAction ($PROJECT$/dist/server.js:14744:21)

like @hmagrini setting locale via shell seem to work for the browser, but not the server version.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purushottamjha picture purushottamjha  路  3Comments

hartjo picture hartjo  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

sysmat picture sysmat  路  3Comments