lt.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // moment.js locale configuration
  2. // locale : Lithuanian (lt)
  3. // author : Mindaugas Mozūras : https://github.com/mmozuras
  4. (function (factory) {
  5. if (typeof define === 'function' && define.amd) {
  6. define(['moment'], factory); // AMD
  7. } else if (typeof exports === 'object') {
  8. module.exports = factory(require('../moment')); // Node
  9. } else {
  10. factory((typeof global !== 'undefined' ? global : this).moment); // node or other global
  11. }
  12. }(function (moment) {
  13. var units = {
  14. 'm' : 'minutė_minutės_minutę',
  15. 'mm': 'minutės_minučių_minutes',
  16. 'h' : 'valanda_valandos_valandą',
  17. 'hh': 'valandos_valandų_valandas',
  18. 'd' : 'diena_dienos_dieną',
  19. 'dd': 'dienos_dienų_dienas',
  20. 'M' : 'mėnuo_mėnesio_mėnesį',
  21. 'MM': 'mėnesiai_mėnesių_mėnesius',
  22. 'y' : 'metai_metų_metus',
  23. 'yy': 'metai_metų_metus'
  24. },
  25. weekDays = 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_');
  26. function translateSeconds(number, withoutSuffix, key, isFuture) {
  27. if (withoutSuffix) {
  28. return 'kelios sekundės';
  29. } else {
  30. return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
  31. }
  32. }
  33. function translateSingular(number, withoutSuffix, key, isFuture) {
  34. return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]);
  35. }
  36. function special(number) {
  37. return number % 10 === 0 || (number > 10 && number < 20);
  38. }
  39. function forms(key) {
  40. return units[key].split('_');
  41. }
  42. function translate(number, withoutSuffix, key, isFuture) {
  43. var result = number + ' ';
  44. if (number === 1) {
  45. return result + translateSingular(number, withoutSuffix, key[0], isFuture);
  46. } else if (withoutSuffix) {
  47. return result + (special(number) ? forms(key)[1] : forms(key)[0]);
  48. } else {
  49. if (isFuture) {
  50. return result + forms(key)[1];
  51. } else {
  52. return result + (special(number) ? forms(key)[1] : forms(key)[2]);
  53. }
  54. }
  55. }
  56. function relativeWeekDay(moment, format) {
  57. var nominative = format.indexOf('dddd HH:mm') === -1,
  58. weekDay = weekDays[moment.day()];
  59. return nominative ? weekDay : weekDay.substring(0, weekDay.length - 2) + 'į';
  60. }
  61. return moment.defineLocale('lt', {
  62. months : 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'),
  63. monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
  64. weekdays : relativeWeekDay,
  65. weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
  66. weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'),
  67. longDateFormat : {
  68. LT : 'HH:mm',
  69. LTS : 'LT:ss',
  70. L : 'YYYY-MM-DD',
  71. LL : 'YYYY [m.] MMMM D [d.]',
  72. LLL : 'YYYY [m.] MMMM D [d.], LT [val.]',
  73. LLLL : 'YYYY [m.] MMMM D [d.], dddd, LT [val.]',
  74. l : 'YYYY-MM-DD',
  75. ll : 'YYYY [m.] MMMM D [d.]',
  76. lll : 'YYYY [m.] MMMM D [d.], LT [val.]',
  77. llll : 'YYYY [m.] MMMM D [d.], ddd, LT [val.]'
  78. },
  79. calendar : {
  80. sameDay : '[Šiandien] LT',
  81. nextDay : '[Rytoj] LT',
  82. nextWeek : 'dddd LT',
  83. lastDay : '[Vakar] LT',
  84. lastWeek : '[Praėjusį] dddd LT',
  85. sameElse : 'L'
  86. },
  87. relativeTime : {
  88. future : 'po %s',
  89. past : 'prieš %s',
  90. s : translateSeconds,
  91. m : translateSingular,
  92. mm : translate,
  93. h : translateSingular,
  94. hh : translate,
  95. d : translateSingular,
  96. dd : translate,
  97. M : translateSingular,
  98. MM : translate,
  99. y : translateSingular,
  100. yy : translate
  101. },
  102. ordinalParse: /\d{1,2}-oji/,
  103. ordinal : function (number) {
  104. return number + '-oji';
  105. },
  106. week : {
  107. dow : 1, // Monday is the first day of the week.
  108. doy : 4 // The week that contains Jan 4th is the first week of the year.
  109. }
  110. });
  111. }));