Node-Red configuration
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.

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