PageRenderTime 33ms CodeModel.GetById 19ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/moment/src/locale/tlh.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 113 lines | 103 code | 7 blank | 3 comment | 4 complexity | 5a6caaf64e7cd0298bdccb0c9a5eec37 MD5 | raw file
  1//! moment.js locale configuration
  2//! locale : Klingon [tlh]
  3//! author : Dominika Kruk : https://github.com/amaranthrose
  4
  5import moment from '../moment';
  6
  7var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
  8
  9function translateFuture(output) {
 10    var time = output;
 11    time = (output.indexOf('jaj') !== -1) ?
 12    time.slice(0, -3) + 'leS' :
 13    (output.indexOf('jar') !== -1) ?
 14    time.slice(0, -3) + 'waQ' :
 15    (output.indexOf('DIS') !== -1) ?
 16    time.slice(0, -3) + 'nem' :
 17    time + ' pIq';
 18    return time;
 19}
 20
 21function translatePast(output) {
 22    var time = output;
 23    time = (output.indexOf('jaj') !== -1) ?
 24    time.slice(0, -3) + 'Hu’' :
 25    (output.indexOf('jar') !== -1) ?
 26    time.slice(0, -3) + 'wen' :
 27    (output.indexOf('DIS') !== -1) ?
 28    time.slice(0, -3) + 'ben' :
 29    time + ' ret';
 30    return time;
 31}
 32
 33function translate(number, withoutSuffix, string, isFuture) {
 34    var numberNoun = numberAsNoun(number);
 35    switch (string) {
 36        case 'ss':
 37            return numberNoun + ' lup';
 38        case 'mm':
 39            return numberNoun + ' tup';
 40        case 'hh':
 41            return numberNoun + ' rep';
 42        case 'dd':
 43            return numberNoun + ' jaj';
 44        case 'MM':
 45            return numberNoun + ' jar';
 46        case 'yy':
 47            return numberNoun + ' DIS';
 48    }
 49}
 50
 51function numberAsNoun(number) {
 52    var hundred = Math.floor((number % 1000) / 100),
 53    ten = Math.floor((number % 100) / 10),
 54    one = number % 10,
 55    word = '';
 56    if (hundred > 0) {
 57        word += numbersNouns[hundred] + 'vatlh';
 58    }
 59    if (ten > 0) {
 60        word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH';
 61    }
 62    if (one > 0) {
 63        word += ((word !== '') ? ' ' : '') + numbersNouns[one];
 64    }
 65    return (word === '') ? 'pagh' : word;
 66}
 67
 68export default moment.defineLocale('tlh', {
 69    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('_'),
 70    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('_'),
 71    monthsParseExact : true,
 72    weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
 73    weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
 74    weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
 75    longDateFormat : {
 76        LT : 'HH:mm',
 77        LTS : 'HH:mm:ss',
 78        L : 'DD.MM.YYYY',
 79        LL : 'D MMMM YYYY',
 80        LLL : 'D MMMM YYYY HH:mm',
 81        LLLL : 'dddd, D MMMM YYYY HH:mm'
 82    },
 83    calendar : {
 84        sameDay: '[DaHjaj] LT',
 85        nextDay: '[wa’leS] LT',
 86        nextWeek: 'LLL',
 87        lastDay: '[wa’Hu’] LT',
 88        lastWeek: 'LLL',
 89        sameElse: 'L'
 90    },
 91    relativeTime : {
 92        future : translateFuture,
 93        past : translatePast,
 94        s : 'puS lup',
 95        ss : translate,
 96        m : 'wa’ tup',
 97        mm : translate,
 98        h : 'wa’ rep',
 99        hh : translate,
100        d : 'wa’ jaj',
101        dd : translate,
102        M : 'wa’ jar',
103        MM : translate,
104        y : 'wa’ DIS',
105        yy : translate
106    },
107    dayOfMonthOrdinalParse: /\d{1,2}\./,
108    ordinal : '%d.',
109    week : {
110        dow : 1, // Monday is the first day of the week.
111        doy : 4  // The week that contains Jan 4th is the first week of the year.
112    }
113});