cscg24-guacamole

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

pa-in.js (5006B)


      1//! moment.js locale configuration
      2//! locale : Punjabi (India) [pa-in]
      3//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit
      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 symbolMap = {
     15            1: '੧',
     16            2: '੨',
     17            3: '੩',
     18            4: '੪',
     19            5: '੫',
     20            6: '੬',
     21            7: '੭',
     22            8: '੮',
     23            9: '੯',
     24            0: '੦',
     25        },
     26        numberMap = {
     27            '੧': '1',
     28            '੨': '2',
     29            '੩': '3',
     30            '੪': '4',
     31            '੫': '5',
     32            '੬': '6',
     33            '੭': '7',
     34            '੮': '8',
     35            '੯': '9',
     36            '੦': '0',
     37        };
     38
     39    var paIn = moment.defineLocale('pa-in', {
     40        // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
     41        months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
     42            '_'
     43        ),
     44        monthsShort:
     45            'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
     46                '_'
     47            ),
     48        weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split(
     49            '_'
     50        ),
     51        weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
     52        weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
     53        longDateFormat: {
     54            LT: 'A h:mm ਵਜੇ',
     55            LTS: 'A h:mm:ss ਵਜੇ',
     56            L: 'DD/MM/YYYY',
     57            LL: 'D MMMM YYYY',
     58            LLL: 'D MMMM YYYY, A h:mm ਵਜੇ',
     59            LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ',
     60        },
     61        calendar: {
     62            sameDay: '[ਅਜ] LT',
     63            nextDay: '[ਕਲ] LT',
     64            nextWeek: '[ਅਗਲਾ] dddd, LT',
     65            lastDay: '[ਕਲ] LT',
     66            lastWeek: '[ਪਿਛਲੇ] dddd, LT',
     67            sameElse: 'L',
     68        },
     69        relativeTime: {
     70            future: '%s ਵਿੱਚ',
     71            past: '%s ਪਿਛਲੇ',
     72            s: 'ਕੁਝ ਸਕਿੰਟ',
     73            ss: '%d ਸਕਿੰਟ',
     74            m: 'ਇਕ ਮਿੰਟ',
     75            mm: '%d ਮਿੰਟ',
     76            h: 'ਇੱਕ ਘੰਟਾ',
     77            hh: '%d ਘੰਟੇ',
     78            d: 'ਇੱਕ ਦਿਨ',
     79            dd: '%d ਦਿਨ',
     80            M: 'ਇੱਕ ਮਹੀਨਾ',
     81            MM: '%d ਮਹੀਨੇ',
     82            y: 'ਇੱਕ ਸਾਲ',
     83            yy: '%d ਸਾਲ',
     84        },
     85        preparse: function (string) {
     86            return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
     87                return numberMap[match];
     88            });
     89        },
     90        postformat: function (string) {
     91            return string.replace(/\d/g, function (match) {
     92                return symbolMap[match];
     93            });
     94        },
     95        // Punjabi notation for meridiems are quite fuzzy in practice. While there exists
     96        // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
     97        meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
     98        meridiemHour: function (hour, meridiem) {
     99            if (hour === 12) {
    100                hour = 0;
    101            }
    102            if (meridiem === 'ਰਾਤ') {
    103                return hour < 4 ? hour : hour + 12;
    104            } else if (meridiem === 'ਸਵੇਰ') {
    105                return hour;
    106            } else if (meridiem === 'ਦੁਪਹਿਰ') {
    107                return hour >= 10 ? hour : hour + 12;
    108            } else if (meridiem === 'ਸ਼ਾਮ') {
    109                return hour + 12;
    110            }
    111        },
    112        meridiem: function (hour, minute, isLower) {
    113            if (hour < 4) {
    114                return 'ਰਾਤ';
    115            } else if (hour < 10) {
    116                return 'ਸਵੇਰ';
    117            } else if (hour < 17) {
    118                return 'ਦੁਪਹਿਰ';
    119            } else if (hour < 20) {
    120                return 'ਸ਼ਾਮ';
    121            } else {
    122                return 'ਰਾਤ';
    123            }
    124        },
    125        week: {
    126            dow: 0, // Sunday is the first day of the week.
    127            doy: 6, // The week that contains Jan 6th is the first week of the year.
    128        },
    129    });
    130
    131    return paIn;
    132
    133})));