index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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: ['R', 'A'],
  10. abbreviated: ['RC', 'AD'],
  11. wide: ['ro Chrìosta', 'anno domini']
  12. };
  13. var quarterValues = {
  14. narrow: ['1', '2', '3', '4'],
  15. abbreviated: ['C1', 'C2', 'C3', 'C4'],
  16. wide: ["a' chiad chairteal", 'an dàrna cairteal', 'an treas cairteal', 'an ceathramh cairteal']
  17. };
  18. // Note: in English, 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: ['F', 'G', 'M', 'G', 'C', 'Ò', 'I', 'L', 'S', 'D', 'S', 'D'],
  24. abbreviated: ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'],
  25. wide: ['Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd']
  26. };
  27. var dayValues = {
  28. narrow: ['D', 'L', 'M', 'C', 'A', 'H', 'S'],
  29. short: ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'],
  30. abbreviated: ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'],
  31. wide: ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']
  32. };
  33. var dayPeriodValues = {
  34. narrow: {
  35. am: 'm',
  36. pm: 'f',
  37. midnight: 'm.o.',
  38. noon: 'm.l.',
  39. morning: 'madainn',
  40. afternoon: 'feasgar',
  41. evening: 'feasgar',
  42. night: 'oidhche'
  43. },
  44. abbreviated: {
  45. am: 'M.',
  46. pm: 'F.',
  47. midnight: 'meadhan oidhche',
  48. noon: 'meadhan là',
  49. morning: 'madainn',
  50. afternoon: 'feasgar',
  51. evening: 'feasgar',
  52. night: 'oidhche'
  53. },
  54. wide: {
  55. am: 'm.',
  56. pm: 'f.',
  57. midnight: 'meadhan oidhche',
  58. noon: 'meadhan là',
  59. morning: 'madainn',
  60. afternoon: 'feasgar',
  61. evening: 'feasgar',
  62. night: 'oidhche'
  63. }
  64. };
  65. var formattingDayPeriodValues = {
  66. narrow: {
  67. am: 'm',
  68. pm: 'f',
  69. midnight: 'm.o.',
  70. noon: 'm.l.',
  71. morning: 'sa mhadainn',
  72. afternoon: 'feasgar',
  73. evening: 'feasgar',
  74. night: 'air an oidhche'
  75. },
  76. abbreviated: {
  77. am: 'M.',
  78. pm: 'F.',
  79. midnight: 'meadhan oidhche',
  80. noon: 'meadhan là',
  81. morning: 'sa mhadainn',
  82. afternoon: 'feasgar',
  83. evening: 'feasgar',
  84. night: 'air an oidhche'
  85. },
  86. wide: {
  87. am: 'm.',
  88. pm: 'f.',
  89. midnight: 'meadhan oidhche',
  90. noon: 'meadhan là',
  91. morning: 'sa mhadainn',
  92. afternoon: 'feasgar',
  93. evening: 'feasgar',
  94. night: 'air an oidhche'
  95. }
  96. };
  97. var ordinalNumber = function ordinalNumber(dirtyNumber) {
  98. var number = Number(dirtyNumber);
  99. var rem100 = number % 100;
  100. if (rem100 > 20 || rem100 < 10) {
  101. switch (rem100 % 10) {
  102. case 1:
  103. return number + 'd';
  104. case 2:
  105. return number + 'na';
  106. }
  107. }
  108. if (rem100 === 12) {
  109. return number + 'na';
  110. }
  111. return number + 'mh';
  112. };
  113. var localize = {
  114. ordinalNumber: ordinalNumber,
  115. era: (0, _index.default)({
  116. values: eraValues,
  117. defaultWidth: 'wide'
  118. }),
  119. quarter: (0, _index.default)({
  120. values: quarterValues,
  121. defaultWidth: 'wide',
  122. argumentCallback: function argumentCallback(quarter) {
  123. return quarter - 1;
  124. }
  125. }),
  126. month: (0, _index.default)({
  127. values: monthValues,
  128. defaultWidth: 'wide'
  129. }),
  130. day: (0, _index.default)({
  131. values: dayValues,
  132. defaultWidth: 'wide'
  133. }),
  134. dayPeriod: (0, _index.default)({
  135. values: dayPeriodValues,
  136. defaultWidth: 'wide',
  137. formattingValues: formattingDayPeriodValues,
  138. defaultFormattingWidth: 'wide'
  139. })
  140. };
  141. var _default = localize;
  142. exports.default = _default;
  143. module.exports = exports.default;