br.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //! moment.js locale configuration
  2. ;(function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined'
  4. && typeof require === 'function' ? factory(require('../moment')) :
  5. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  6. factory(global.moment)
  7. }(this, (function (moment) { 'use strict';
  8. function relativeTimeWithMutation(number, withoutSuffix, key) {
  9. var format = {
  10. 'mm': 'munutenn',
  11. 'MM': 'miz',
  12. 'dd': 'devezh'
  13. };
  14. return number + ' ' + mutation(format[key], number);
  15. }
  16. function specialMutationForYears(number) {
  17. switch (lastNumber(number)) {
  18. case 1:
  19. case 3:
  20. case 4:
  21. case 5:
  22. case 9:
  23. return number + ' bloaz';
  24. default:
  25. return number + ' vloaz';
  26. }
  27. }
  28. function lastNumber(number) {
  29. if (number > 9) {
  30. return lastNumber(number % 10);
  31. }
  32. return number;
  33. }
  34. function mutation(text, number) {
  35. if (number === 2) {
  36. return softMutation(text);
  37. }
  38. return text;
  39. }
  40. function softMutation(text) {
  41. var mutationTable = {
  42. 'm': 'v',
  43. 'b': 'v',
  44. 'd': 'z'
  45. };
  46. if (mutationTable[text.charAt(0)] === undefined) {
  47. return text;
  48. }
  49. return mutationTable[text.charAt(0)] + text.substring(1);
  50. }
  51. var br = moment.defineLocale('br', {
  52. months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
  53. monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  54. weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
  55. weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  56. weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  57. weekdaysParseExact : true,
  58. longDateFormat : {
  59. LT : 'h[e]mm A',
  60. LTS : 'h[e]mm:ss A',
  61. L : 'DD/MM/YYYY',
  62. LL : 'D [a viz] MMMM YYYY',
  63. LLL : 'D [a viz] MMMM YYYY h[e]mm A',
  64. LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A'
  65. },
  66. calendar : {
  67. sameDay : '[Hiziv da] LT',
  68. nextDay : '[Warc\'hoazh da] LT',
  69. nextWeek : 'dddd [da] LT',
  70. lastDay : '[Dec\'h da] LT',
  71. lastWeek : 'dddd [paset da] LT',
  72. sameElse : 'L'
  73. },
  74. relativeTime : {
  75. future : 'a-benn %s',
  76. past : '%s \'zo',
  77. s : 'un nebeud segondennoù',
  78. ss : '%d eilenn',
  79. m : 'ur vunutenn',
  80. mm : relativeTimeWithMutation,
  81. h : 'un eur',
  82. hh : '%d eur',
  83. d : 'un devezh',
  84. dd : relativeTimeWithMutation,
  85. M : 'ur miz',
  86. MM : relativeTimeWithMutation,
  87. y : 'ur bloaz',
  88. yy : specialMutationForYears
  89. },
  90. dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
  91. ordinal : function (number) {
  92. var output = (number === 1) ? 'añ' : 'vet';
  93. return number + output;
  94. },
  95. week : {
  96. dow : 1, // Monday is the first day of the week.
  97. doy : 4 // The week that contains Jan 4th is the first week of the year.
  98. }
  99. });
  100. return br;
  101. })));