a68235bc3c76e8296626d7f595954439df931b7ccd12ed6148be315c7170347afdc7c74b60f6a66c1eec6ff1cab7ab1b3660f390bbd3b1a8eba8b1b00abd5d 3.4 KB

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