UNPKG

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