Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

br.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Breton [br]
  2. import dayjs from '../index';
  3. function lastNumber(number) {
  4. if (number > 9) {
  5. return lastNumber(number % 10);
  6. }
  7. return number;
  8. }
  9. function softMutation(text) {
  10. var mutationTable = {
  11. m: 'v',
  12. b: 'v',
  13. d: 'z'
  14. };
  15. return mutationTable[text.charAt(0)] + text.substring(1);
  16. }
  17. function mutation(text, number) {
  18. if (number === 2) {
  19. return softMutation(text);
  20. }
  21. return text;
  22. }
  23. function relativeTimeWithMutation(number, withoutSuffix, key) {
  24. var format = {
  25. mm: 'munutenn',
  26. MM: 'miz',
  27. dd: 'devezh'
  28. };
  29. return number + " " + mutation(format[key], number);
  30. }
  31. function specialMutationForYears(number) {
  32. /* istanbul ignore next line */
  33. switch (lastNumber(number)) {
  34. case 1:
  35. case 3:
  36. case 4:
  37. case 5:
  38. case 9:
  39. return number + " bloaz";
  40. default:
  41. return number + " vloaz";
  42. }
  43. }
  44. var locale = {
  45. name: 'br',
  46. weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
  47. months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
  48. weekStart: 1,
  49. weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  50. monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  51. weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  52. ordinal: function ordinal(n) {
  53. return n;
  54. },
  55. formats: {
  56. LT: 'h[e]mm A',
  57. LTS: 'h[e]mm:ss A',
  58. L: 'DD/MM/YYYY',
  59. LL: 'D [a viz] MMMM YYYY',
  60. LLL: 'D [a viz] MMMM YYYY h[e]mm A',
  61. LLLL: 'dddd, D [a viz] MMMM YYYY h[e]mm A'
  62. },
  63. relativeTime: {
  64. future: 'a-benn %s',
  65. past: '%s ʼzo',
  66. s: 'un nebeud segondennoù',
  67. m: 'ur vunutenn',
  68. mm: relativeTimeWithMutation,
  69. h: 'un eur',
  70. hh: '%d eur',
  71. d: 'un devezh',
  72. dd: relativeTimeWithMutation,
  73. M: 'ur miz',
  74. MM: relativeTimeWithMutation,
  75. y: 'ur bloaz',
  76. yy: specialMutationForYears
  77. },
  78. meridiem: function meridiem(hour) {
  79. return hour < 12 ? 'a.m.' : 'g.m.';
  80. } // a-raok merenn | goude merenn
  81. };
  82. dayjs.locale(locale, null, true);
  83. export default locale;