de.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // German [de]
  2. import dayjs from '../index';
  3. var texts = {
  4. s: 'ein paar Sekunden',
  5. m: ['eine Minute', 'einer Minute'],
  6. mm: '%d Minuten',
  7. h: ['eine Stunde', 'einer Stunde'],
  8. hh: '%d Stunden',
  9. d: ['ein Tag', 'einem Tag'],
  10. dd: ['%d Tage', '%d Tagen'],
  11. M: ['ein Monat', 'einem Monat'],
  12. MM: ['%d Monate', '%d Monaten'],
  13. y: ['ein Jahr', 'einem Jahr'],
  14. yy: ['%d Jahre', '%d Jahren']
  15. };
  16. function relativeTimeFormatter(number, withoutSuffix, key) {
  17. var l = texts[key];
  18. if (Array.isArray(l)) {
  19. l = l[withoutSuffix ? 0 : 1];
  20. }
  21. return l.replace('%d', number);
  22. }
  23. var locale = {
  24. name: 'de',
  25. weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
  26. weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
  27. weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  28. months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
  29. monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.'.split('_'),
  30. ordinal: function ordinal(n) {
  31. return n + ".";
  32. },
  33. weekStart: 1,
  34. yearStart: 4,
  35. formats: {
  36. LTS: 'HH:mm:ss',
  37. LT: 'HH:mm',
  38. L: 'DD.MM.YYYY',
  39. LL: 'D. MMMM YYYY',
  40. LLL: 'D. MMMM YYYY HH:mm',
  41. LLLL: 'dddd, D. MMMM YYYY HH:mm'
  42. },
  43. relativeTime: {
  44. future: 'in %s',
  45. past: 'vor %s',
  46. s: relativeTimeFormatter,
  47. m: relativeTimeFormatter,
  48. mm: relativeTimeFormatter,
  49. h: relativeTimeFormatter,
  50. hh: relativeTimeFormatter,
  51. d: relativeTimeFormatter,
  52. dd: relativeTimeFormatter,
  53. M: relativeTimeFormatter,
  54. MM: relativeTimeFormatter,
  55. y: relativeTimeFormatter,
  56. yy: relativeTimeFormatter
  57. }
  58. };
  59. dayjs.locale(locale, null, true);
  60. export default locale;