br.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 = /^(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,
  63. monthsStrictRegex = /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,
  64. monthsShortStrictRegex = /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
  65. fullWeekdaysParse = [
  66. /^sul/i,
  67. /^lun/i,
  68. /^meurzh/i,
  69. /^merc[ʼ\']her/i,
  70. /^yaou/i,
  71. /^gwener/i,
  72. /^sadorn/i,
  73. ],
  74. shortWeekdaysParse = [
  75. /^Sul/i,
  76. /^Lun/i,
  77. /^Meu/i,
  78. /^Mer/i,
  79. /^Yao/i,
  80. /^Gwe/i,
  81. /^Sad/i,
  82. ],
  83. minWeekdaysParse = [
  84. /^Su/i,
  85. /^Lu/i,
  86. /^Me([^r]|$)/i,
  87. /^Mer/i,
  88. /^Ya/i,
  89. /^Gw/i,
  90. /^Sa/i,
  91. ];
  92. export default moment.defineLocale('br', {
  93. months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split(
  94. '_'
  95. ),
  96. monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  97. weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
  98. weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  99. weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  100. weekdaysParse: minWeekdaysParse,
  101. fullWeekdaysParse: fullWeekdaysParse,
  102. shortWeekdaysParse: shortWeekdaysParse,
  103. minWeekdaysParse: minWeekdaysParse,
  104. monthsRegex: monthsRegex,
  105. monthsShortRegex: monthsRegex,
  106. monthsStrictRegex: monthsStrictRegex,
  107. monthsShortStrictRegex: monthsShortStrictRegex,
  108. monthsParse: monthsParse,
  109. longMonthsParse: monthsParse,
  110. shortMonthsParse: monthsParse,
  111. longDateFormat: {
  112. LT: 'HH:mm',
  113. LTS: 'HH:mm:ss',
  114. L: 'DD/MM/YYYY',
  115. LL: 'D [a viz] MMMM YYYY',
  116. LLL: 'D [a viz] MMMM YYYY HH:mm',
  117. LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm',
  118. },
  119. calendar: {
  120. sameDay: '[Hiziv da] LT',
  121. nextDay: '[Warcʼhoazh da] LT',
  122. nextWeek: 'dddd [da] LT',
  123. lastDay: '[Decʼh da] LT',
  124. lastWeek: 'dddd [paset da] LT',
  125. sameElse: 'L',
  126. },
  127. relativeTime: {
  128. future: 'a-benn %s',
  129. past: '%s ʼzo',
  130. s: 'un nebeud segondennoù',
  131. ss: '%d eilenn',
  132. m: 'ur vunutenn',
  133. mm: relativeTimeWithMutation,
  134. h: 'un eur',
  135. hh: '%d eur',
  136. d: 'un devezh',
  137. dd: relativeTimeWithMutation,
  138. M: 'ur miz',
  139. MM: relativeTimeWithMutation,
  140. y: 'ur bloaz',
  141. yy: specialMutationForYears,
  142. },
  143. dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
  144. ordinal: function (number) {
  145. var output = number === 1 ? 'añ' : 'vet';
  146. return number + output;
  147. },
  148. week: {
  149. dow: 1, // Monday is the first day of the week.
  150. doy: 4, // The week that contains Jan 4th is the first week of the year.
  151. },
  152. meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn
  153. isPM: function (token) {
  154. return token === 'g.m.';
  155. },
  156. meridiem: function (hour, minute, isLower) {
  157. return hour < 12 ? 'a.m.' : 'g.m.';
  158. },
  159. });