de-ch.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // German (Switzerland) [de-ch]
  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-ch',
  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._Sep._Okt._Nov._Dez.'.split('_'),
  30. ordinal: function ordinal(n) {
  31. return n + ".";
  32. },
  33. weekStart: 1,
  34. formats: {
  35. LT: 'HH:mm',
  36. LTS: 'HH:mm:ss',
  37. L: 'DD.MM.YYYY',
  38. LL: 'D. MMMM YYYY',
  39. LLL: 'D. MMMM YYYY HH:mm',
  40. LLLL: 'dddd, D. MMMM YYYY HH:mm'
  41. },
  42. relativeTime: {
  43. future: 'in %s',
  44. past: 'vor %s',
  45. s: relativeTimeFormatter,
  46. m: relativeTimeFormatter,
  47. mm: relativeTimeFormatter,
  48. h: relativeTimeFormatter,
  49. hh: relativeTimeFormatter,
  50. d: relativeTimeFormatter,
  51. dd: relativeTimeFormatter,
  52. M: relativeTimeFormatter,
  53. MM: relativeTimeFormatter,
  54. y: relativeTimeFormatter,
  55. yy: relativeTimeFormatter
  56. }
  57. };
  58. dayjs.locale(locale, null, true);
  59. export default locale;