You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
4.2 KiB

  1. //! moment.js locale configuration
  2. //! locale : Klingon [tlh]
  3. //! author : Dominika Kruk : https://github.com/amaranthrose
  4. ;(function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined'
  6. && typeof require === 'function' ? factory(require('../moment')) :
  7. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  8. factory(global.moment)
  9. }(this, function (moment) { 'use strict';
  10. var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
  11. function translateFuture(output) {
  12. var time = output;
  13. time = (output.indexOf('jaj') !== -1) ?
  14. time.slice(0, -3) + 'leS' :
  15. (output.indexOf('jar') !== -1) ?
  16. time.slice(0, -3) + 'waQ' :
  17. (output.indexOf('DIS') !== -1) ?
  18. time.slice(0, -3) + 'nem' :
  19. time + ' pIq';
  20. return time;
  21. }
  22. function translatePast(output) {
  23. var time = output;
  24. time = (output.indexOf('jaj') !== -1) ?
  25. time.slice(0, -3) + 'Hu’' :
  26. (output.indexOf('jar') !== -1) ?
  27. time.slice(0, -3) + 'wen' :
  28. (output.indexOf('DIS') !== -1) ?
  29. time.slice(0, -3) + 'ben' :
  30. time + ' ret';
  31. return time;
  32. }
  33. function translate(number, withoutSuffix, string, isFuture) {
  34. var numberNoun = numberAsNoun(number);
  35. switch (string) {
  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. m : 'wa’ tup',
  92. mm : translate,
  93. h : 'wa’ rep',
  94. hh : translate,
  95. d : 'wa’ jaj',
  96. dd : translate,
  97. M : 'wa’ jar',
  98. MM : translate,
  99. y : 'wa’ DIS',
  100. yy : translate
  101. },
  102. ordinalParse: /\d{1,2}\./,
  103. ordinal : '%d.',
  104. week : {
  105. dow : 1, // Monday is the first day of the week.
  106. doy : 4 // The week that contains Jan 4th is the first week of the year.
  107. }
  108. });
  109. return tlh;
  110. }));