br.js 5.4 KB

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