br.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // moment.js language configuration
  2. // language : 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(window.moment); // Browser 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.lang('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. L : "DD/MM/YYYY",
  65. LL : "D [a viz] MMMM YYYY",
  66. LLL : "D [a viz] MMMM YYYY LT",
  67. LLLL : "dddd, D [a viz] MMMM YYYY LT"
  68. },
  69. calendar : {
  70. sameDay : '[Hiziv da] LT',
  71. nextDay : '[Warc\'hoazh da] LT',
  72. nextWeek : 'dddd [da] LT',
  73. lastDay : '[Dec\'h da] LT',
  74. lastWeek : 'dddd [paset da] LT',
  75. sameElse : 'L'
  76. },
  77. relativeTime : {
  78. future : "a-benn %s",
  79. past : "%s 'zo",
  80. s : "un nebeud segondennoù",
  81. m : "ur vunutenn",
  82. mm : relativeTimeWithMutation,
  83. h : "un eur",
  84. hh : "%d eur",
  85. d : "un devezh",
  86. dd : relativeTimeWithMutation,
  87. M : "ur miz",
  88. MM : relativeTimeWithMutation,
  89. y : "ur bloaz",
  90. yy : specialMutationForYears
  91. },
  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. }));