cscg24-guacamole

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

me.js (3665B)


      1//! moment.js locale configuration
      2//! locale : Montenegrin [me]
      3//! author : Miodrag Nikač <miodrag@restartit.me> : https://github.com/miodragnikac
      4
      5import moment from '../moment';
      6
      7var translator = {
      8    words: {
      9        //Different grammatical cases
     10        ss: ['sekund', 'sekunda', 'sekundi'],
     11        m: ['jedan minut', 'jednog minuta'],
     12        mm: ['minut', 'minuta', 'minuta'],
     13        h: ['jedan sat', 'jednog sata'],
     14        hh: ['sat', 'sata', 'sati'],
     15        dd: ['dan', 'dana', 'dana'],
     16        MM: ['mjesec', 'mjeseca', 'mjeseci'],
     17        yy: ['godina', 'godine', 'godina'],
     18    },
     19    correctGrammaticalCase: function (number, wordKey) {
     20        return number === 1
     21            ? wordKey[0]
     22            : number >= 2 && number <= 4
     23              ? wordKey[1]
     24              : wordKey[2];
     25    },
     26    translate: function (number, withoutSuffix, key) {
     27        var wordKey = translator.words[key];
     28        if (key.length === 1) {
     29            return withoutSuffix ? wordKey[0] : wordKey[1];
     30        } else {
     31            return (
     32                number +
     33                ' ' +
     34                translator.correctGrammaticalCase(number, wordKey)
     35            );
     36        }
     37    },
     38};
     39
     40export default moment.defineLocale('me', {
     41    months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
     42        '_'
     43    ),
     44    monthsShort:
     45        'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
     46    monthsParseExact: true,
     47    weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
     48        '_'
     49    ),
     50    weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
     51    weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
     52    weekdaysParseExact: true,
     53    longDateFormat: {
     54        LT: 'H:mm',
     55        LTS: 'H:mm:ss',
     56        L: 'DD.MM.YYYY',
     57        LL: 'D. MMMM YYYY',
     58        LLL: 'D. MMMM YYYY H:mm',
     59        LLLL: 'dddd, D. MMMM YYYY H:mm',
     60    },
     61    calendar: {
     62        sameDay: '[danas u] LT',
     63        nextDay: '[sjutra u] LT',
     64
     65        nextWeek: function () {
     66            switch (this.day()) {
     67                case 0:
     68                    return '[u] [nedjelju] [u] LT';
     69                case 3:
     70                    return '[u] [srijedu] [u] LT';
     71                case 6:
     72                    return '[u] [subotu] [u] LT';
     73                case 1:
     74                case 2:
     75                case 4:
     76                case 5:
     77                    return '[u] dddd [u] LT';
     78            }
     79        },
     80        lastDay: '[juče u] LT',
     81        lastWeek: function () {
     82            var lastWeekDays = [
     83                '[prošle] [nedjelje] [u] LT',
     84                '[prošlog] [ponedjeljka] [u] LT',
     85                '[prošlog] [utorka] [u] LT',
     86                '[prošle] [srijede] [u] LT',
     87                '[prošlog] [četvrtka] [u] LT',
     88                '[prošlog] [petka] [u] LT',
     89                '[prošle] [subote] [u] LT',
     90            ];
     91            return lastWeekDays[this.day()];
     92        },
     93        sameElse: 'L',
     94    },
     95    relativeTime: {
     96        future: 'za %s',
     97        past: 'prije %s',
     98        s: 'nekoliko sekundi',
     99        ss: translator.translate,
    100        m: translator.translate,
    101        mm: translator.translate,
    102        h: translator.translate,
    103        hh: translator.translate,
    104        d: 'dan',
    105        dd: translator.translate,
    106        M: 'mjesec',
    107        MM: translator.translate,
    108        y: 'godinu',
    109        yy: translator.translate,
    110    },
    111    dayOfMonthOrdinalParse: /\d{1,2}\./,
    112    ordinal: '%d.',
    113    week: {
    114        dow: 1, // Monday is the first day of the week.
    115        doy: 7, // The week that contains Jan 7th is the first week of the year.
    116    },
    117});