localize.cjs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. "use strict";
  2. exports.localize = void 0;
  3. var _index = require("../../_lib/buildLocalizeFn.cjs");
  4. const eraValues = {
  5. narrow: ["R", "A"],
  6. abbreviated: ["RC", "AD"],
  7. wide: ["ro Chrìosta", "anno domini"],
  8. };
  9. const quarterValues = {
  10. narrow: ["1", "2", "3", "4"],
  11. abbreviated: ["C1", "C2", "C3", "C4"],
  12. wide: [
  13. "a' chiad chairteal",
  14. "an dàrna cairteal",
  15. "an treas cairteal",
  16. "an ceathramh cairteal",
  17. ],
  18. };
  19. // Note: in English, the names of days of the week and months are capitalized.
  20. // If you are making a new locale based on this one, check if the same is true for the language you're working on.
  21. // Generally, formatted dates should look like they are in the middle of a sentence,
  22. // e.g. in Spanish language the weekdays and months should be in the lowercase.
  23. const monthValues = {
  24. narrow: ["F", "G", "M", "G", "C", "Ò", "I", "L", "S", "D", "S", "D"],
  25. abbreviated: [
  26. "Faoi",
  27. "Gear",
  28. "Màrt",
  29. "Gibl",
  30. "Cèit",
  31. "Ògmh",
  32. "Iuch",
  33. "Lùn",
  34. "Sult",
  35. "Dàmh",
  36. "Samh",
  37. "Dùbh",
  38. ],
  39. wide: [
  40. "Am Faoilleach",
  41. "An Gearran",
  42. "Am Màrt",
  43. "An Giblean",
  44. "An Cèitean",
  45. "An t-Ògmhios",
  46. "An t-Iuchar",
  47. "An Lùnastal",
  48. "An t-Sultain",
  49. "An Dàmhair",
  50. "An t-Samhain",
  51. "An Dùbhlachd",
  52. ],
  53. };
  54. const dayValues = {
  55. narrow: ["D", "L", "M", "C", "A", "H", "S"],
  56. short: ["Dò", "Lu", "Mà", "Ci", "Ar", "Ha", "Sa"],
  57. abbreviated: ["Did", "Dil", "Dim", "Dic", "Dia", "Dih", "Dis"],
  58. wide: [
  59. "Didòmhnaich",
  60. "Diluain",
  61. "Dimàirt",
  62. "Diciadain",
  63. "Diardaoin",
  64. "Dihaoine",
  65. "Disathairne",
  66. ],
  67. };
  68. const dayPeriodValues = {
  69. narrow: {
  70. am: "m",
  71. pm: "f",
  72. midnight: "m.o.",
  73. noon: "m.l.",
  74. morning: "madainn",
  75. afternoon: "feasgar",
  76. evening: "feasgar",
  77. night: "oidhche",
  78. },
  79. abbreviated: {
  80. am: "M.",
  81. pm: "F.",
  82. midnight: "meadhan oidhche",
  83. noon: "meadhan là",
  84. morning: "madainn",
  85. afternoon: "feasgar",
  86. evening: "feasgar",
  87. night: "oidhche",
  88. },
  89. wide: {
  90. am: "m.",
  91. pm: "f.",
  92. midnight: "meadhan oidhche",
  93. noon: "meadhan là",
  94. morning: "madainn",
  95. afternoon: "feasgar",
  96. evening: "feasgar",
  97. night: "oidhche",
  98. },
  99. };
  100. const formattingDayPeriodValues = {
  101. narrow: {
  102. am: "m",
  103. pm: "f",
  104. midnight: "m.o.",
  105. noon: "m.l.",
  106. morning: "sa mhadainn",
  107. afternoon: "feasgar",
  108. evening: "feasgar",
  109. night: "air an oidhche",
  110. },
  111. abbreviated: {
  112. am: "M.",
  113. pm: "F.",
  114. midnight: "meadhan oidhche",
  115. noon: "meadhan là",
  116. morning: "sa mhadainn",
  117. afternoon: "feasgar",
  118. evening: "feasgar",
  119. night: "air an oidhche",
  120. },
  121. wide: {
  122. am: "m.",
  123. pm: "f.",
  124. midnight: "meadhan oidhche",
  125. noon: "meadhan là",
  126. morning: "sa mhadainn",
  127. afternoon: "feasgar",
  128. evening: "feasgar",
  129. night: "air an oidhche",
  130. },
  131. };
  132. const ordinalNumber = (dirtyNumber) => {
  133. const number = Number(dirtyNumber);
  134. const rem100 = number % 100;
  135. if (rem100 > 20 || rem100 < 10) {
  136. switch (rem100 % 10) {
  137. case 1:
  138. return number + "d";
  139. case 2:
  140. return number + "na";
  141. }
  142. }
  143. if (rem100 === 12) {
  144. return number + "na";
  145. }
  146. return number + "mh";
  147. };
  148. const localize = (exports.localize = {
  149. ordinalNumber,
  150. era: (0, _index.buildLocalizeFn)({
  151. values: eraValues,
  152. defaultWidth: "wide",
  153. }),
  154. quarter: (0, _index.buildLocalizeFn)({
  155. values: quarterValues,
  156. defaultWidth: "wide",
  157. argumentCallback: (quarter) => quarter - 1,
  158. }),
  159. month: (0, _index.buildLocalizeFn)({
  160. values: monthValues,
  161. defaultWidth: "wide",
  162. }),
  163. day: (0, _index.buildLocalizeFn)({
  164. values: dayValues,
  165. defaultWidth: "wide",
  166. }),
  167. dayPeriod: (0, _index.buildLocalizeFn)({
  168. values: dayPeriodValues,
  169. defaultWidth: "wide",
  170. formattingValues: formattingDayPeriodValues,
  171. defaultFormattingWidth: "wide",
  172. }),
  173. });