br.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //! moment.js locale configuration
  2. //! locale : Breton [br]
  3. //! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
  4. import moment from '../moment';
  5. function relativeTimeWithMutation(number, withoutSuffix, key) {
  6. var format = {
  7. mm: 'munutenn',
  8. MM: 'miz',
  9. dd: 'devezh',
  10. };
  11. return number + ' ' + mutation(format[key], number);
  12. }
  13. function specialMutationForYears(number) {
  14. switch (lastNumber(number)) {
  15. case 1:
  16. case 3:
  17. case 4:
  18. case 5:
  19. case 9:
  20. return number + ' bloaz';
  21. default:
  22. return number + ' vloaz';
  23. }
  24. }
  25. function lastNumber(number) {
  26. if (number > 9) {
  27. return lastNumber(number % 10);
  28. }
  29. return number;
  30. }
  31. function mutation(text, number) {
  32. if (number === 2) {
  33. return softMutation(text);
  34. }
  35. return text;
  36. }
  37. function softMutation(text) {
  38. var mutationTable = {
  39. m: 'v',
  40. b: 'v',
  41. d: 'z',
  42. };
  43. if (mutationTable[text.charAt(0)] === undefined) {
  44. return text;
  45. }
  46. return mutationTable[text.charAt(0)] + text.substring(1);
  47. }
  48. var monthsParse = [
  49. /^gen/i,
  50. /^c[ʼ\']hwe/i,
  51. /^meu/i,
  52. /^ebr/i,
  53. /^mae/i,
  54. /^(mez|eve)/i,
  55. /^gou/i,
  56. /^eos/i,
  57. /^gwe/i,
  58. /^her/i,
  59. /^du/i,
  60. /^ker/i,
  61. ],
  62. monthsRegex =
  63. /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
  64. monthsStrictRegex =
  65. /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,
  66. monthsShortStrictRegex =
  67. /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
  68. fullWeekdaysParse = [
  69. /^sul/i,
  70. /^lun/i,
  71. /^meurzh/i,
  72. /^merc[ʼ\']her/i,
  73. /^yaou/i,
  74. /^gwener/i,
  75. /^sadorn/i,
  76. ],
  77. shortWeekdaysParse = [
  78. /^Sul/i,
  79. /^Lun/i,
  80. /^Meu/i,
  81. /^Mer/i,
  82. /^Yao/i,
  83. /^Gwe/i,
  84. /^Sad/i,
  85. ],
  86. minWeekdaysParse = [
  87. /^Su/i,
  88. /^Lu/i,
  89. /^Me([^r]|$)/i,
  90. /^Mer/i,
  91. /^Ya/i,
  92. /^Gw/i,
  93. /^Sa/i,
  94. ];
  95. export default moment.defineLocale('br', {
  96. months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split(
  97. '_'
  98. ),
  99. monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  100. weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
  101. weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  102. weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  103. weekdaysParse: minWeekdaysParse,
  104. fullWeekdaysParse: fullWeekdaysParse,
  105. shortWeekdaysParse: shortWeekdaysParse,
  106. minWeekdaysParse: minWeekdaysParse,
  107. monthsRegex: monthsRegex,
  108. monthsShortRegex: monthsRegex,
  109. monthsStrictRegex: monthsStrictRegex,
  110. monthsShortStrictRegex: monthsShortStrictRegex,
  111. monthsParse: monthsParse,
  112. longMonthsParse: monthsParse,
  113. shortMonthsParse: monthsParse,
  114. longDateFormat: {
  115. LT: 'HH:mm',
  116. LTS: 'HH:mm:ss',
  117. L: 'DD/MM/YYYY',
  118. LL: 'D [a viz] MMMM YYYY',
  119. LLL: 'D [a viz] MMMM YYYY HH:mm',
  120. LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm',
  121. },
  122. calendar: {
  123. sameDay: '[Hiziv da] LT',
  124. nextDay: '[Warcʼhoazh da] LT',
  125. nextWeek: 'dddd [da] LT',
  126. lastDay: '[Decʼh da] LT',
  127. lastWeek: 'dddd [paset da] LT',
  128. sameElse: 'L',
  129. },
  130. relativeTime: {
  131. future: 'a-benn %s',
  132. past: '%s ʼzo',
  133. s: 'un nebeud segondennoù',
  134. ss: '%d eilenn',
  135. m: 'ur vunutenn',
  136. mm: relativeTimeWithMutation,
  137. h: 'un eur',
  138. hh: '%d eur',
  139. d: 'un devezh',
  140. dd: relativeTimeWithMutation,
  141. M: 'ur miz',
  142. MM: relativeTimeWithMutation,
  143. y: 'ur bloaz',
  144. yy: specialMutationForYears,
  145. },
  146. dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
  147. ordinal: function (number) {
  148. var output = number === 1 ? 'añ' : 'vet';
  149. return number + output;
  150. },
  151. week: {
  152. dow: 1, // Monday is the first day of the week.
  153. doy: 4, // The week that contains Jan 4th is the first week of the year.
  154. },
  155. meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn
  156. isPM: function (token) {
  157. return token === 'g.m.';
  158. },
  159. meridiem: function (hour, minute, isLower) {
  160. return hour < 12 ? 'a.m.' : 'g.m.';
  161. },
  162. });