/node_modules/moment/src/locale/tlh.js

https://bitbucket.org/coleman333/smartsite · JavaScript · 113 lines · 103 code · 7 blank · 3 comment · 4 complexity · 5a6caaf64e7cd0298bdccb0c9a5eec37 MD5 · raw file

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