GPQAPP

Форк
0
136 строк · 4.4 Кб
1
//! moment.js locale configuration
2
//! locale : Klingon [tlh]
3
//! author : Dominika Kruk : https://github.com/amaranthrose
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 numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
15

16
    function translateFuture(output) {
17
        var time = output;
18
        time =
19
            output.indexOf('jaj') !== -1
20
                ? time.slice(0, -3) + 'leS'
21
                : output.indexOf('jar') !== -1
22
                ? time.slice(0, -3) + 'waQ'
23
                : output.indexOf('DIS') !== -1
24
                ? time.slice(0, -3) + 'nem'
25
                : time + ' pIq';
26
        return time;
27
    }
28

29
    function translatePast(output) {
30
        var time = output;
31
        time =
32
            output.indexOf('jaj') !== -1
33
                ? time.slice(0, -3) + 'Hu’'
34
                : output.indexOf('jar') !== -1
35
                ? time.slice(0, -3) + 'wen'
36
                : output.indexOf('DIS') !== -1
37
                ? time.slice(0, -3) + 'ben'
38
                : time + ' ret';
39
        return time;
40
    }
41

42
    function translate(number, withoutSuffix, string, isFuture) {
43
        var numberNoun = numberAsNoun(number);
44
        switch (string) {
45
            case 'ss':
46
                return numberNoun + ' lup';
47
            case 'mm':
48
                return numberNoun + ' tup';
49
            case 'hh':
50
                return numberNoun + ' rep';
51
            case 'dd':
52
                return numberNoun + ' jaj';
53
            case 'MM':
54
                return numberNoun + ' jar';
55
            case 'yy':
56
                return numberNoun + ' DIS';
57
        }
58
    }
59

60
    function numberAsNoun(number) {
61
        var hundred = Math.floor((number % 1000) / 100),
62
            ten = Math.floor((number % 100) / 10),
63
            one = number % 10,
64
            word = '';
65
        if (hundred > 0) {
66
            word += numbersNouns[hundred] + 'vatlh';
67
        }
68
        if (ten > 0) {
69
            word += (word !== '' ? ' ' : '') + numbersNouns[ten] + 'maH';
70
        }
71
        if (one > 0) {
72
            word += (word !== '' ? ' ' : '') + numbersNouns[one];
73
        }
74
        return word === '' ? 'pagh' : word;
75
    }
76

77
    var tlh = moment.defineLocale('tlh', {
78
        months: 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split(
79
            '_'
80
        ),
81
        monthsShort: 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split(
82
            '_'
83
        ),
84
        monthsParseExact: true,
85
        weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
86
            '_'
87
        ),
88
        weekdaysShort: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
89
            '_'
90
        ),
91
        weekdaysMin: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
92
            '_'
93
        ),
94
        longDateFormat: {
95
            LT: 'HH:mm',
96
            LTS: 'HH:mm:ss',
97
            L: 'DD.MM.YYYY',
98
            LL: 'D MMMM YYYY',
99
            LLL: 'D MMMM YYYY HH:mm',
100
            LLLL: 'dddd, D MMMM YYYY HH:mm',
101
        },
102
        calendar: {
103
            sameDay: '[DaHjaj] LT',
104
            nextDay: '[wa’leS] LT',
105
            nextWeek: 'LLL',
106
            lastDay: '[wa’Hu’] LT',
107
            lastWeek: 'LLL',
108
            sameElse: 'L',
109
        },
110
        relativeTime: {
111
            future: translateFuture,
112
            past: translatePast,
113
            s: 'puS lup',
114
            ss: translate,
115
            m: 'wa’ tup',
116
            mm: translate,
117
            h: 'wa’ rep',
118
            hh: translate,
119
            d: 'wa’ jaj',
120
            dd: translate,
121
            M: 'wa’ jar',
122
            MM: translate,
123
            y: 'wa’ DIS',
124
            yy: translate,
125
        },
126
        dayOfMonthOrdinalParse: /\d{1,2}\./,
127
        ordinal: '%d.',
128
        week: {
129
            dow: 1, // Monday is the first day of the week.
130
            doy: 4, // The week that contains Jan 4th is the first week of the year.
131
        },
132
    });
133

134
    return tlh;
135

136
})));
137

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.