localize.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
  2. // https://www.unicode.org/cldr/charts/32/summary/gu.html
  3. // #1621 - #1630
  4. const eraValues = {
  5. narrow: ["ઈસપૂ", "ઈસ"],
  6. abbreviated: ["ઈ.સ.પૂર્વે", "ઈ.સ."],
  7. wide: ["ઈસવીસન પૂર્વે", "ઈસવીસન"],
  8. };
  9. // https://www.unicode.org/cldr/charts/32/summary/gu.html
  10. // #1631 - #1654
  11. const quarterValues = {
  12. narrow: ["1", "2", "3", "4"],
  13. abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  14. wide: ["1લો ત્રિમાસ", "2જો ત્રિમાસ", "3જો ત્રિમાસ", "4થો ત્રિમાસ"],
  15. };
  16. // 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. // https://www.unicode.org/cldr/charts/32/summary/gu.html
  21. // #1655 - #1726
  22. const monthValues = {
  23. narrow: ["જા", "ફે", "મા", "એ", "મે", "જૂ", "જુ", "ઓ", "સ", "ઓ", "ન", "ડિ"],
  24. abbreviated: [
  25. "જાન્યુ",
  26. "ફેબ્રુ",
  27. "માર્ચ",
  28. "એપ્રિલ",
  29. "મે",
  30. "જૂન",
  31. "જુલાઈ",
  32. "ઑગસ્ટ",
  33. "સપ્ટે",
  34. "ઓક્ટો",
  35. "નવે",
  36. "ડિસે",
  37. ],
  38. wide: [
  39. "જાન્યુઆરી",
  40. "ફેબ્રુઆરી",
  41. "માર્ચ",
  42. "એપ્રિલ",
  43. "મે",
  44. "જૂન",
  45. "જુલાઇ",
  46. "ઓગસ્ટ",
  47. "સપ્ટેમ્બર",
  48. "ઓક્ટોબર",
  49. "નવેમ્બર",
  50. "ડિસેમ્બર",
  51. ],
  52. };
  53. // https://www.unicode.org/cldr/charts/32/summary/gu.html
  54. // #1727 - #1768
  55. const dayValues = {
  56. narrow: ["ર", "સો", "મં", "બુ", "ગુ", "શુ", "શ"],
  57. short: ["ર", "સો", "મં", "બુ", "ગુ", "શુ", "શ"],
  58. abbreviated: ["રવિ", "સોમ", "મંગળ", "બુધ", "ગુરુ", "શુક્ર", "શનિ"],
  59. wide: [
  60. "રવિવાર" /* Sunday */,
  61. "સોમવાર" /* Monday */,
  62. "મંગળવાર" /* Tuesday */,
  63. "બુધવાર" /* Wednesday */,
  64. "ગુરુવાર" /* Thursday */,
  65. "શુક્રવાર" /* Friday */,
  66. "શનિવાર" /* Saturday */,
  67. ],
  68. };
  69. // https://www.unicode.org/cldr/charts/32/summary/gu.html
  70. // #1783 - #1824
  71. const dayPeriodValues = {
  72. narrow: {
  73. am: "AM",
  74. pm: "PM",
  75. midnight: "મ.રાત્રિ",
  76. noon: "બ.",
  77. morning: "સવારે",
  78. afternoon: "બપોરે",
  79. evening: "સાંજે",
  80. night: "રાત્રે",
  81. },
  82. abbreviated: {
  83. am: "AM",
  84. pm: "PM",
  85. midnight: "​મધ્યરાત્રિ",
  86. noon: "બપોરે",
  87. morning: "સવારે",
  88. afternoon: "બપોરે",
  89. evening: "સાંજે",
  90. night: "રાત્રે",
  91. },
  92. wide: {
  93. am: "AM",
  94. pm: "PM",
  95. midnight: "​મધ્યરાત્રિ",
  96. noon: "બપોરે",
  97. morning: "સવારે",
  98. afternoon: "બપોરે",
  99. evening: "સાંજે",
  100. night: "રાત્રે",
  101. },
  102. };
  103. const formattingDayPeriodValues = {
  104. narrow: {
  105. am: "AM",
  106. pm: "PM",
  107. midnight: "મ.રાત્રિ",
  108. noon: "બપોરે",
  109. morning: "સવારે",
  110. afternoon: "બપોરે",
  111. evening: "સાંજે",
  112. night: "રાત્રે",
  113. },
  114. abbreviated: {
  115. am: "AM",
  116. pm: "PM",
  117. midnight: "મધ્યરાત્રિ",
  118. noon: "બપોરે",
  119. morning: "સવારે",
  120. afternoon: "બપોરે",
  121. evening: "સાંજે",
  122. night: "રાત્રે",
  123. },
  124. wide: {
  125. am: "AM",
  126. pm: "PM",
  127. midnight: "​મધ્યરાત્રિ",
  128. noon: "બપોરે",
  129. morning: "સવારે",
  130. afternoon: "બપોરે",
  131. evening: "સાંજે",
  132. night: "રાત્રે",
  133. },
  134. };
  135. const ordinalNumber = (dirtyNumber, _options) => {
  136. return String(dirtyNumber);
  137. };
  138. export const localize = {
  139. ordinalNumber,
  140. era: buildLocalizeFn({
  141. values: eraValues,
  142. defaultWidth: "wide",
  143. }),
  144. quarter: buildLocalizeFn({
  145. values: quarterValues,
  146. defaultWidth: "wide",
  147. argumentCallback: (quarter) => quarter - 1,
  148. }),
  149. month: buildLocalizeFn({
  150. values: monthValues,
  151. defaultWidth: "wide",
  152. }),
  153. day: buildLocalizeFn({
  154. values: dayValues,
  155. defaultWidth: "wide",
  156. }),
  157. dayPeriod: buildLocalizeFn({
  158. values: dayPeriodValues,
  159. defaultWidth: "wide",
  160. formattingValues: formattingDayPeriodValues,
  161. defaultFormattingWidth: "wide",
  162. }),
  163. };