Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs filter 'date' and $locale service

it seems that angularjs embed some internationalized resources:

Angular supports i18n/l10n for date, number and currency filters. Additionally, Angular supports localizable pluralization support through the ngPluralize directive. All localizable Angular components depend on locale-specific rule sets managed by the $locale service.

If found the $locale service but don't kwnow how to specify the locale in fr-fr...

The following code :

{{article.date_collected | date:'EEEE dd MMMM yyyy'}}

Gives :

Monday 06 October 2014

But I want :

Lundi 06 Octobre 2014

Any suggestions?

like image 387
Patrick Ferreira Avatar asked Oct 06 '14 12:10

Patrick Ferreira


1 Answers

Finally I found the response on the angular github page: https://github.com/angular/bower-angular-i18n#bower-angular-i18n

EDIT : more info for what worked for me

In your root app directory, install resources from bower

bower install angular-i18n

Add a <script> to your index.html between this comments tags if you use bower/buildjs to compact all your scripts to vendor.js file :

<!-- endbower -->
<script src="bower_components/angular-i18n/angular-locale_fr-fr.js"></script>
<!-- endbuild -->

That's it.

like image 196
Patrick Ferreira Avatar answered Sep 28 '22 05:09

Patrick Ferreira