cscg24-guacamole

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

is.js (4458B)


      1//! moment.js locale configuration
      2//! locale : Icelandic [is]
      3//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik
      4
      5import moment from '../moment';
      6
      7function plural(n) {
      8    if (n % 100 === 11) {
      9        return true;
     10    } else if (n % 10 === 1) {
     11        return false;
     12    }
     13    return true;
     14}
     15function translate(number, withoutSuffix, key, isFuture) {
     16    var result = number + ' ';
     17    switch (key) {
     18        case 's':
     19            return withoutSuffix || isFuture
     20                ? 'nokkrar sekúndur'
     21                : 'nokkrum sekúndum';
     22        case 'ss':
     23            if (plural(number)) {
     24                return (
     25                    result +
     26                    (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum')
     27                );
     28            }
     29            return result + 'sekúnda';
     30        case 'm':
     31            return withoutSuffix ? 'mínúta' : 'mínútu';
     32        case 'mm':
     33            if (plural(number)) {
     34                return (
     35                    result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum')
     36                );
     37            } else if (withoutSuffix) {
     38                return result + 'mínúta';
     39            }
     40            return result + 'mínútu';
     41        case 'hh':
     42            if (plural(number)) {
     43                return (
     44                    result +
     45                    (withoutSuffix || isFuture
     46                        ? 'klukkustundir'
     47                        : 'klukkustundum')
     48                );
     49            }
     50            return result + 'klukkustund';
     51        case 'd':
     52            if (withoutSuffix) {
     53                return 'dagur';
     54            }
     55            return isFuture ? 'dag' : 'degi';
     56        case 'dd':
     57            if (plural(number)) {
     58                if (withoutSuffix) {
     59                    return result + 'dagar';
     60                }
     61                return result + (isFuture ? 'daga' : 'dögum');
     62            } else if (withoutSuffix) {
     63                return result + 'dagur';
     64            }
     65            return result + (isFuture ? 'dag' : 'degi');
     66        case 'M':
     67            if (withoutSuffix) {
     68                return 'mánuður';
     69            }
     70            return isFuture ? 'mánuð' : 'mánuði';
     71        case 'MM':
     72            if (plural(number)) {
     73                if (withoutSuffix) {
     74                    return result + 'mánuðir';
     75                }
     76                return result + (isFuture ? 'mánuði' : 'mánuðum');
     77            } else if (withoutSuffix) {
     78                return result + 'mánuður';
     79            }
     80            return result + (isFuture ? 'mánuð' : 'mánuði');
     81        case 'y':
     82            return withoutSuffix || isFuture ? 'ár' : 'ári';
     83        case 'yy':
     84            if (plural(number)) {
     85                return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
     86            }
     87            return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
     88    }
     89}
     90
     91export default moment.defineLocale('is', {
     92    months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split(
     93        '_'
     94    ),
     95    monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
     96    weekdays:
     97        'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split(
     98            '_'
     99        ),
    100    weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
    101    weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
    102    longDateFormat: {
    103        LT: 'H:mm',
    104        LTS: 'H:mm:ss',
    105        L: 'DD.MM.YYYY',
    106        LL: 'D. MMMM YYYY',
    107        LLL: 'D. MMMM YYYY [kl.] H:mm',
    108        LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm',
    109    },
    110    calendar: {
    111        sameDay: '[í dag kl.] LT',
    112        nextDay: '[á morgun kl.] LT',
    113        nextWeek: 'dddd [kl.] LT',
    114        lastDay: '[í gær kl.] LT',
    115        lastWeek: '[síðasta] dddd [kl.] LT',
    116        sameElse: 'L',
    117    },
    118    relativeTime: {
    119        future: 'eftir %s',
    120        past: 'fyrir %s síðan',
    121        s: translate,
    122        ss: translate,
    123        m: translate,
    124        mm: translate,
    125        h: 'klukkustund',
    126        hh: translate,
    127        d: translate,
    128        dd: translate,
    129        M: translate,
    130        MM: translate,
    131        y: translate,
    132        yy: translate,
    133    },
    134    dayOfMonthOrdinalParse: /\d{1,2}\./,
    135    ordinal: '%d.',
    136    week: {
    137        dow: 1, // Monday is the first day of the week.
    138        doy: 4, // The week that contains Jan 4th is the first week of the year.
    139    },
    140});