localize.cjs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. "use strict";
  2. exports.localize = void 0;
  3. var _index = require("../../_lib/buildLocalizeFn.cjs");
  4. // Most data for localization are taken from this page
  5. // https://www.unicode.org/cldr/charts/32/summary/ms.html
  6. const eraValues = {
  7. narrow: ["SM", "M"],
  8. abbreviated: ["SM", "M"],
  9. wide: ["Sebelum Masihi", "Masihi"],
  10. };
  11. const quarterValues = {
  12. narrow: ["1", "2", "3", "4"],
  13. abbreviated: ["S1", "S2", "S3", "S4"],
  14. wide: ["Suku pertama", "Suku kedua", "Suku ketiga", "Suku keempat"],
  15. };
  16. // Note: in Malay, 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. const monthValues = {
  21. narrow: ["J", "F", "M", "A", "M", "J", "J", "O", "S", "O", "N", "D"],
  22. abbreviated: [
  23. "Jan",
  24. "Feb",
  25. "Mac",
  26. "Apr",
  27. "Mei",
  28. "Jun",
  29. "Jul",
  30. "Ogo",
  31. "Sep",
  32. "Okt",
  33. "Nov",
  34. "Dis",
  35. ],
  36. wide: [
  37. "Januari",
  38. "Februari",
  39. "Mac",
  40. "April",
  41. "Mei",
  42. "Jun",
  43. "Julai",
  44. "Ogos",
  45. "September",
  46. "Oktober",
  47. "November",
  48. "Disember",
  49. ],
  50. };
  51. const dayValues = {
  52. narrow: ["A", "I", "S", "R", "K", "J", "S"],
  53. short: ["Ahd", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab"],
  54. abbreviated: ["Ahd", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab"],
  55. wide: ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu"],
  56. };
  57. const dayPeriodValues = {
  58. narrow: {
  59. am: "am",
  60. pm: "pm",
  61. midnight: "tgh malam",
  62. noon: "tgh hari",
  63. morning: "pagi",
  64. afternoon: "tengah hari",
  65. evening: "petang",
  66. night: "malam",
  67. },
  68. abbreviated: {
  69. am: "AM",
  70. pm: "PM",
  71. midnight: "tengah malam",
  72. noon: "tengah hari",
  73. morning: "pagi",
  74. afternoon: "tengah hari",
  75. evening: "petang",
  76. night: "malam",
  77. },
  78. wide: {
  79. am: "a.m.",
  80. pm: "p.m.",
  81. midnight: "tengah malam",
  82. noon: "tengah hari",
  83. morning: "pagi",
  84. afternoon: "tengah hari",
  85. evening: "petang",
  86. night: "malam",
  87. },
  88. };
  89. const formattingDayPeriodValues = {
  90. narrow: {
  91. am: "am",
  92. pm: "pm",
  93. midnight: "tengah malam",
  94. noon: "tengah hari",
  95. morning: "pagi",
  96. afternoon: "tengah hari",
  97. evening: "petang",
  98. night: "malam",
  99. },
  100. abbreviated: {
  101. am: "AM",
  102. pm: "PM",
  103. midnight: "tengah malam",
  104. noon: "tengah hari",
  105. morning: "pagi",
  106. afternoon: "tengah hari",
  107. evening: "petang",
  108. night: "malam",
  109. },
  110. wide: {
  111. am: "a.m.",
  112. pm: "p.m.",
  113. midnight: "tengah malam",
  114. noon: "tengah hari",
  115. morning: "pagi",
  116. afternoon: "tengah hari",
  117. evening: "petang",
  118. night: "malam",
  119. },
  120. };
  121. const ordinalNumber = (dirtyNumber, _options) => {
  122. // Can't use "pertama", "kedua" because can't be parsed
  123. return "ke-" + Number(dirtyNumber);
  124. };
  125. const localize = (exports.localize = {
  126. ordinalNumber,
  127. era: (0, _index.buildLocalizeFn)({
  128. values: eraValues,
  129. defaultWidth: "wide",
  130. }),
  131. quarter: (0, _index.buildLocalizeFn)({
  132. values: quarterValues,
  133. defaultWidth: "wide",
  134. argumentCallback: (quarter) => quarter - 1,
  135. }),
  136. month: (0, _index.buildLocalizeFn)({
  137. values: monthValues,
  138. defaultWidth: "wide",
  139. }),
  140. day: (0, _index.buildLocalizeFn)({
  141. values: dayValues,
  142. defaultWidth: "wide",
  143. }),
  144. dayPeriod: (0, _index.buildLocalizeFn)({
  145. values: dayPeriodValues,
  146. defaultWidth: "wide",
  147. formattingValues: formattingDayPeriodValues,
  148. defaultFormattingWidth: "wide",
  149. }),
  150. });