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