cscg24-guacamole

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

me.js (4445B)


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