cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

br.js (4544B)


      1//! moment.js locale configuration
      2//! locale : Breton [br]
      3//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
      4
      5import moment from '../moment';
      6
      7function relativeTimeWithMutation(number, withoutSuffix, key) {
      8    var format = {
      9        mm: 'munutenn',
     10        MM: 'miz',
     11        dd: 'devezh',
     12    };
     13    return number + ' ' + mutation(format[key], number);
     14}
     15function specialMutationForYears(number) {
     16    switch (lastNumber(number)) {
     17        case 1:
     18        case 3:
     19        case 4:
     20        case 5:
     21        case 9:
     22            return number + ' bloaz';
     23        default:
     24            return number + ' vloaz';
     25    }
     26}
     27function lastNumber(number) {
     28    if (number > 9) {
     29        return lastNumber(number % 10);
     30    }
     31    return number;
     32}
     33function mutation(text, number) {
     34    if (number === 2) {
     35        return softMutation(text);
     36    }
     37    return text;
     38}
     39function softMutation(text) {
     40    var mutationTable = {
     41        m: 'v',
     42        b: 'v',
     43        d: 'z',
     44    };
     45    if (mutationTable[text.charAt(0)] === undefined) {
     46        return text;
     47    }
     48    return mutationTable[text.charAt(0)] + text.substring(1);
     49}
     50
     51var monthsParse = [
     52        /^gen/i,
     53        /^c[ʼ\']hwe/i,
     54        /^meu/i,
     55        /^ebr/i,
     56        /^mae/i,
     57        /^(mez|eve)/i,
     58        /^gou/i,
     59        /^eos/i,
     60        /^gwe/i,
     61        /^her/i,
     62        /^du/i,
     63        /^ker/i,
     64    ],
     65    monthsRegex =
     66        /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
     67    monthsStrictRegex =
     68        /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,
     69    monthsShortStrictRegex =
     70        /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
     71    fullWeekdaysParse = [
     72        /^sul/i,
     73        /^lun/i,
     74        /^meurzh/i,
     75        /^merc[ʼ\']her/i,
     76        /^yaou/i,
     77        /^gwener/i,
     78        /^sadorn/i,
     79    ],
     80    shortWeekdaysParse = [
     81        /^Sul/i,
     82        /^Lun/i,
     83        /^Meu/i,
     84        /^Mer/i,
     85        /^Yao/i,
     86        /^Gwe/i,
     87        /^Sad/i,
     88    ],
     89    minWeekdaysParse = [
     90        /^Su/i,
     91        /^Lu/i,
     92        /^Me([^r]|$)/i,
     93        /^Mer/i,
     94        /^Ya/i,
     95        /^Gw/i,
     96        /^Sa/i,
     97    ];
     98
     99export default moment.defineLocale('br', {
    100    months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split(
    101        '_'
    102    ),
    103    monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
    104    weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
    105    weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
    106    weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
    107    weekdaysParse: minWeekdaysParse,
    108    fullWeekdaysParse: fullWeekdaysParse,
    109    shortWeekdaysParse: shortWeekdaysParse,
    110    minWeekdaysParse: minWeekdaysParse,
    111
    112    monthsRegex: monthsRegex,
    113    monthsShortRegex: monthsRegex,
    114    monthsStrictRegex: monthsStrictRegex,
    115    monthsShortStrictRegex: monthsShortStrictRegex,
    116    monthsParse: monthsParse,
    117    longMonthsParse: monthsParse,
    118    shortMonthsParse: monthsParse,
    119
    120    longDateFormat: {
    121        LT: 'HH:mm',
    122        LTS: 'HH:mm:ss',
    123        L: 'DD/MM/YYYY',
    124        LL: 'D [a viz] MMMM YYYY',
    125        LLL: 'D [a viz] MMMM YYYY HH:mm',
    126        LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm',
    127    },
    128    calendar: {
    129        sameDay: '[Hiziv da] LT',
    130        nextDay: '[Warcʼhoazh da] LT',
    131        nextWeek: 'dddd [da] LT',
    132        lastDay: '[Decʼh da] LT',
    133        lastWeek: 'dddd [paset da] LT',
    134        sameElse: 'L',
    135    },
    136    relativeTime: {
    137        future: 'a-benn %s',
    138        past: '%s ʼzo',
    139        s: 'un nebeud segondennoù',
    140        ss: '%d eilenn',
    141        m: 'ur vunutenn',
    142        mm: relativeTimeWithMutation,
    143        h: 'un eur',
    144        hh: '%d eur',
    145        d: 'un devezh',
    146        dd: relativeTimeWithMutation,
    147        M: 'ur miz',
    148        MM: relativeTimeWithMutation,
    149        y: 'ur bloaz',
    150        yy: specialMutationForYears,
    151    },
    152    dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
    153    ordinal: function (number) {
    154        var output = number === 1 ? 'añ' : 'vet';
    155        return number + output;
    156    },
    157    week: {
    158        dow: 1, // Monday is the first day of the week.
    159        doy: 4, // The week that contains Jan 4th is the first week of the year.
    160    },
    161    meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn
    162    isPM: function (token) {
    163        return token === 'g.m.';
    164    },
    165    meridiem: function (hour, minute, isLower) {
    166        return hour < 12 ? 'a.m.' : 'g.m.';
    167    },
    168});