Ei kuvausta

tlh.js 4.1KB

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