index.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var eraValues = {
  9. narrow: ['C', 'O'],
  10. abbreviated: ['CC', 'OC'],
  11. wide: ['Cyn Crist', 'Ar ôl Crist']
  12. };
  13. var quarterValues = {
  14. narrow: ['1', '2', '3', '4'],
  15. abbreviated: ['Ch1', 'Ch2', 'Ch3', 'Ch4'],
  16. wide: ['Chwarter 1af', '2ail chwarter', '3ydd chwarter', '4ydd chwarter'] // Note: in English, the names of days of the week and months are capitalized.
  17. // If you are making a new locale based on this one, check if the same is true for the language you're working on.
  18. // Generally, formatted dates should look like they are in the middle of a sentence,
  19. // e.g. in Spanish language the weekdays and months should be in the lowercase.
  20. };
  21. var monthValues = {
  22. narrow: ['I', 'Ch', 'Ma', 'E', 'Mi', 'Me', 'G', 'A', 'Md', 'H', 'T', 'Rh'],
  23. abbreviated: ['Ion', 'Chwe', 'Maw', 'Ebr', 'Mai', 'Meh', 'Gor', 'Aws', 'Med', 'Hyd', 'Tach', 'Rhag'],
  24. wide: ['Ionawr', 'Chwefror', 'Mawrth', 'Ebrill', 'Mai', 'Mehefin', 'Gorffennaf', 'Awst', 'Medi', 'Hydref', 'Tachwedd', 'Rhagfyr']
  25. };
  26. var dayValues = {
  27. narrow: ['S', 'Ll', 'M', 'M', 'I', 'G', 'S'],
  28. short: ['Su', 'Ll', 'Ma', 'Me', 'Ia', 'Gw', 'Sa'],
  29. abbreviated: ['Sul', 'Llun', 'Maw', 'Mer', 'Iau', 'Gwe', 'Sad'],
  30. wide: ['dydd Sul', 'dydd Llun', 'dydd Mawrth', 'dydd Mercher', 'dydd Iau', 'dydd Gwener', 'dydd Sadwrn']
  31. };
  32. var dayPeriodValues = {
  33. narrow: {
  34. am: 'b',
  35. pm: 'h',
  36. midnight: 'hn',
  37. noon: 'hd',
  38. morning: 'bore',
  39. afternoon: 'prynhawn',
  40. evening: "gyda'r nos",
  41. night: 'nos'
  42. },
  43. abbreviated: {
  44. am: 'yb',
  45. pm: 'yh',
  46. midnight: 'hanner nos',
  47. noon: 'hanner dydd',
  48. morning: 'bore',
  49. afternoon: 'prynhawn',
  50. evening: "gyda'r nos",
  51. night: 'nos'
  52. },
  53. wide: {
  54. am: 'y.b.',
  55. pm: 'y.h.',
  56. midnight: 'hanner nos',
  57. noon: 'hanner dydd',
  58. morning: 'bore',
  59. afternoon: 'prynhawn',
  60. evening: "gyda'r nos",
  61. night: 'nos'
  62. }
  63. };
  64. var formattingDayPeriodValues = {
  65. narrow: {
  66. am: 'b',
  67. pm: 'h',
  68. midnight: 'hn',
  69. noon: 'hd',
  70. morning: 'yn y bore',
  71. afternoon: 'yn y prynhawn',
  72. evening: "gyda'r nos",
  73. night: 'yn y nos'
  74. },
  75. abbreviated: {
  76. am: 'yb',
  77. pm: 'yh',
  78. midnight: 'hanner nos',
  79. noon: 'hanner dydd',
  80. morning: 'yn y bore',
  81. afternoon: 'yn y prynhawn',
  82. evening: "gyda'r nos",
  83. night: 'yn y nos'
  84. },
  85. wide: {
  86. am: 'y.b.',
  87. pm: 'y.h.',
  88. midnight: 'hanner nos',
  89. noon: 'hanner dydd',
  90. morning: 'yn y bore',
  91. afternoon: 'yn y prynhawn',
  92. evening: "gyda'r nos",
  93. night: 'yn y nos'
  94. }
  95. };
  96. function ordinalNumber(dirtyNumber, _dirtyOptions) {
  97. var number = Number(dirtyNumber);
  98. if (number < 20) {
  99. switch (number) {
  100. case 0:
  101. return number + 'fed';
  102. case 1:
  103. return number + 'af';
  104. case 2:
  105. return number + 'ail';
  106. case 3:
  107. case 4:
  108. return number + 'ydd';
  109. case 5:
  110. case 6:
  111. return number + 'ed';
  112. case 7:
  113. case 8:
  114. case 9:
  115. case 10:
  116. case 12:
  117. case 15:
  118. case 18:
  119. return number + 'fed';
  120. case 11:
  121. case 13:
  122. case 14:
  123. case 16:
  124. case 17:
  125. case 19:
  126. return number + 'eg';
  127. }
  128. } else if (number >= 50 && number <= 60 || number === 80 || number >= 100) {
  129. return number + 'fed';
  130. }
  131. return number + 'ain';
  132. }
  133. var localize = {
  134. ordinalNumber: ordinalNumber,
  135. era: (0, _index.default)({
  136. values: eraValues,
  137. defaultWidth: 'wide'
  138. }),
  139. quarter: (0, _index.default)({
  140. values: quarterValues,
  141. defaultWidth: 'wide',
  142. argumentCallback: function (quarter) {
  143. return Number(quarter) - 1;
  144. }
  145. }),
  146. month: (0, _index.default)({
  147. values: monthValues,
  148. defaultWidth: 'wide'
  149. }),
  150. day: (0, _index.default)({
  151. values: dayValues,
  152. defaultWidth: 'wide'
  153. }),
  154. dayPeriod: (0, _index.default)({
  155. values: dayPeriodValues,
  156. defaultWidth: 'wide',
  157. formattingValues: formattingDayPeriodValues,
  158. defaultFormattingWidth: 'wide'
  159. })
  160. };
  161. var _default = localize;
  162. exports.default = _default;
  163. module.exports = exports.default;