Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
967 views
in Technique[技术] by (71.8m points)

javascript - Missing locale data for the locale "ru" Angular 5

I updated Angular to version 5 and get this error

Error

It seems to me the error with pipe in this line

<h5>{{ event.date | date:"yyyy.MM.dd"}}</h5>.

Anybody knows how to fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems you don't update your pipe since breacking change of angular 5 see: https://github.com/angular/angular/blob/master/CHANGELOG.md

  • by default Angular now only contains locale data for the language en-US, if you set the value of LOCALE_ID to another locale, you will have to import new locale data for this language because we don't use the intl API anymore.
  • all i18n pipes now have an additional last parameter locale which allows you to use a specific locale instead of the one defined in the token LOCALE_ID (whose default value is en-US).
  • the predefined formats (short, shortTime, shortDate, medium, ...) now use the patterns given by CLDR (like it was in AngularJS) instead of the ones from the intl API. You might notice some changes, e.g. shortDate will be 8/15/17 instead of 8/15/2017 for en-US.

  • the narrow version of eras is now GGGGG instead of G, the format G is now similar to GG and GGG.

  • the narrow version of months is now MMMMM instead of L, the format L is now the short standalone version of months.
  • the narrow version of the week day is now EEEEE instead of E, the format E is now similar to EE and EEE.
  • the timezone z will now fallback to O and output GMT+1 instead of the complete zone name (e.g. Pacific Standard Time), this is because the quantity of data required to have all the zone names in all of the existing locales is too big.
  • the timezone Z will now output the ISO8601 basic format, e.g. +0100, you should now use ZZZZ to get GMT+01:00.

    You should change your date pipe

    enter image description here

Also you need to provide your language in app.module like this:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...