index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
  8. var eraValues = {
  9. narrow: ['v.Chr.', 'n.Chr.'],
  10. abbreviated: ['v.Chr.', 'n.Chr.'],
  11. wide: ['vor Christus', 'nach Christus']
  12. };
  13. var quarterValues = {
  14. narrow: ['1', '2', '3', '4'],
  15. abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
  16. wide: ['1. Quartal', '2. Quartal', '3. Quartal', '4. Quartal']
  17. };
  18. // Note: in German, the names of days of the week and months are capitalized.
  19. // If you are making a new locale based on this one, check if the same is true for the language you're working on.
  20. // Generally, formatted dates should look like they are in the middle of a sentence,
  21. // e.g. in Spanish language the weekdays and months should be in the lowercase.
  22. var monthValues = {
  23. narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  24. abbreviated: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  25. wide: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
  26. };
  27. // https://st.unicode.org/cldr-apps/v#/de/Gregorian/
  28. var formattingMonthValues = {
  29. narrow: monthValues.narrow,
  30. abbreviated: ['Jan.', 'Feb.', 'März', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Dez.'],
  31. wide: monthValues.wide
  32. };
  33. var dayValues = {
  34. narrow: ['S', 'M', 'D', 'M', 'D', 'F', 'S'],
  35. short: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  36. abbreviated: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
  37. wide: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
  38. };
  39. // https://www.unicode.org/cldr/charts/32/summary/de.html#1881
  40. var dayPeriodValues = {
  41. narrow: {
  42. am: 'vm.',
  43. pm: 'nm.',
  44. midnight: 'Mitternacht',
  45. noon: 'Mittag',
  46. morning: 'Morgen',
  47. afternoon: 'Nachm.',
  48. evening: 'Abend',
  49. night: 'Nacht'
  50. },
  51. abbreviated: {
  52. am: 'vorm.',
  53. pm: 'nachm.',
  54. midnight: 'Mitternacht',
  55. noon: 'Mittag',
  56. morning: 'Morgen',
  57. afternoon: 'Nachmittag',
  58. evening: 'Abend',
  59. night: 'Nacht'
  60. },
  61. wide: {
  62. am: 'vormittags',
  63. pm: 'nachmittags',
  64. midnight: 'Mitternacht',
  65. noon: 'Mittag',
  66. morning: 'Morgen',
  67. afternoon: 'Nachmittag',
  68. evening: 'Abend',
  69. night: 'Nacht'
  70. }
  71. };
  72. var formattingDayPeriodValues = {
  73. narrow: {
  74. am: 'vm.',
  75. pm: 'nm.',
  76. midnight: 'Mitternacht',
  77. noon: 'Mittag',
  78. morning: 'morgens',
  79. afternoon: 'nachm.',
  80. evening: 'abends',
  81. night: 'nachts'
  82. },
  83. abbreviated: {
  84. am: 'vorm.',
  85. pm: 'nachm.',
  86. midnight: 'Mitternacht',
  87. noon: 'Mittag',
  88. morning: 'morgens',
  89. afternoon: 'nachmittags',
  90. evening: 'abends',
  91. night: 'nachts'
  92. },
  93. wide: {
  94. am: 'vormittags',
  95. pm: 'nachmittags',
  96. midnight: 'Mitternacht',
  97. noon: 'Mittag',
  98. morning: 'morgens',
  99. afternoon: 'nachmittags',
  100. evening: 'abends',
  101. night: 'nachts'
  102. }
  103. };
  104. var ordinalNumber = function ordinalNumber(dirtyNumber) {
  105. var number = Number(dirtyNumber);
  106. return number + '.';
  107. };
  108. var localize = {
  109. ordinalNumber: ordinalNumber,
  110. era: (0, _index.default)({
  111. values: eraValues,
  112. defaultWidth: 'wide'
  113. }),
  114. quarter: (0, _index.default)({
  115. values: quarterValues,
  116. defaultWidth: 'wide',
  117. argumentCallback: function argumentCallback(quarter) {
  118. return quarter - 1;
  119. }
  120. }),
  121. month: (0, _index.default)({
  122. values: monthValues,
  123. formattingValues: formattingMonthValues,
  124. defaultWidth: 'wide'
  125. }),
  126. day: (0, _index.default)({
  127. values: dayValues,
  128. defaultWidth: 'wide'
  129. }),
  130. dayPeriod: (0, _index.default)({
  131. values: dayPeriodValues,
  132. defaultWidth: 'wide',
  133. formattingValues: formattingDayPeriodValues,
  134. defaultFormattingWidth: 'wide'
  135. })
  136. };
  137. var _default = localize;
  138. exports.default = _default;
  139. module.exports = exports.default;