javascript.js 963 B

12345678910111213141516171819202122232425262728293031
  1. angular
  2. .module('mwl.calendar.docs')
  3. .controller('i18nCtrl', function($scope, $window, $ocLazyLoad, calendarConfig, moment) {
  4. var vm = this;
  5. vm.events = [];
  6. vm.calendarView = 'month';
  7. vm.viewDate = moment().startOf('month').toDate();
  8. calendarConfig.dateFormatter = 'moment'; // use moment instead of angular for formatting dates
  9. calendarConfig.i18nStrings.eventsLabel = 'Des événements';
  10. calendarConfig.i18nStrings.timeLabel = 'Temps';
  11. calendarConfig.i18nStrings.weekNumber = 'Semaine {week}';
  12. $window.moment = $window.moment || moment;
  13. $ocLazyLoad.load('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/locale/fr.js').then(function() {
  14. moment.locale('fr', {
  15. week: {
  16. dow: 1 // Monday is the first day of the week
  17. }
  18. });
  19. moment.locale('fr'); // change the locale to french
  20. });
  21. $scope.$on('$destroy', function() {
  22. moment.locale('en');
  23. });
  24. });