UNPKG

4.55 kBJavaScriptView Raw
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:
82 '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(
83 '_'
84 ),
85 monthsParseExact: true,
86 weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
87 '_'
88 ),
89 weekdaysShort:
90 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
91 weekdaysMin:
92 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
93 longDateFormat: {
94 LT: 'HH:mm',
95 LTS: 'HH:mm:ss',
96 L: 'DD.MM.YYYY',
97 LL: 'D MMMM YYYY',
98 LLL: 'D MMMM YYYY HH:mm',
99 LLLL: 'dddd, D MMMM YYYY HH:mm',
100 },
101 calendar: {
102 sameDay: '[DaHjaj] LT',
103 nextDay: '[wa’leS] LT',
104 nextWeek: 'LLL',
105 lastDay: '[wa’Hu’] LT',
106 lastWeek: 'LLL',
107 sameElse: 'L',
108 },
109 relativeTime: {
110 future: translateFuture,
111 past: translatePast,
112 s: 'puS lup',
113 ss: translate,
114 m: 'wa’ tup',
115 mm: translate,
116 h: 'wa’ rep',
117 hh: translate,
118 d: 'wa’ jaj',
119 dd: translate,
120 M: 'wa’ jar',
121 MM: translate,
122 y: 'wa’ DIS',
123 yy: translate,
124 },
125 dayOfMonthOrdinalParse: /\d{1,2}\./,
126 ordinal: '%d.',
127 week: {
128 dow: 1, // Monday is the first day of the week.
129 doy: 4, // The week that contains Jan 4th is the first week of the year.
130 },
131 });
132
133 return tlh;
134
135})));