br.js 3.4 KB

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