cscg24-guacamole

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

pa-in.js (4198B)


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