br.js 3.4 KB

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