br.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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' ? factory(require('../moment')) :
  6. typeof define === 'function' && define.amd ? define(['moment'], factory) :
  7. factory(global.moment)
  8. }(this, function (moment) { 'use strict';
  9. function relativeTimeWithMutation(number, withoutSuffix, key) {
  10. var format = {
  11. 'mm': 'munutenn',
  12. 'MM': 'miz',
  13. 'dd': 'devezh'
  14. };
  15. return number + ' ' + mutation(format[key], number);
  16. }
  17. function specialMutationForYears(number) {
  18. switch (lastNumber(number)) {
  19. case 1:
  20. case 3:
  21. case 4:
  22. case 5:
  23. case 9:
  24. return number + ' bloaz';
  25. default:
  26. return number + ' vloaz';
  27. }
  28. }
  29. function lastNumber(number) {
  30. if (number > 9) {
  31. return lastNumber(number % 10);
  32. }
  33. return number;
  34. }
  35. function mutation(text, number) {
  36. if (number === 2) {
  37. return softMutation(text);
  38. }
  39. return text;
  40. }
  41. function softMutation(text) {
  42. var mutationTable = {
  43. 'm': 'v',
  44. 'b': 'v',
  45. 'd': 'z'
  46. };
  47. if (mutationTable[text.charAt(0)] === undefined) {
  48. return text;
  49. }
  50. return mutationTable[text.charAt(0)] + text.substring(1);
  51. }
  52. var br = moment.defineLocale('br', {
  53. months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
  54. monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  55. weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
  56. weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  57. weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  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. m : 'ur vunutenn',
  79. mm : relativeTimeWithMutation,
  80. h : 'un eur',
  81. hh : '%d eur',
  82. d : 'un devezh',
  83. dd : relativeTimeWithMutation,
  84. M : 'ur miz',
  85. MM : relativeTimeWithMutation,
  86. y : 'ur bloaz',
  87. yy : specialMutationForYears
  88. },
  89. ordinalParse: /\d{1,2}(añ|vet)/,
  90. ordinal : function (number) {
  91. var output = (number === 1) ? 'añ' : 'vet';
  92. return number + output;
  93. },
  94. week : {
  95. dow : 1, // Monday is the first day of the week.
  96. doy : 4 // The week that contains Jan 4th is the first week of the year.
  97. }
  98. });
  99. return br;
  100. }));