lt.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // moment.js language configuration
  2. // language : 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(window.moment); // Browser 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.lang("lt", {
  62. months : "sausio_vasario_kovo_balandžio_gegužės_biržėlio_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. L : "YYYY-MM-DD",
  70. LL : "YYYY [m.] MMMM D [d.]",
  71. LLL : "YYYY [m.] MMMM D [d.], LT [val.]",
  72. LLLL : "YYYY [m.] MMMM D [d.], dddd, LT [val.]",
  73. l : "YYYY-MM-DD",
  74. ll : "YYYY [m.] MMMM D [d.]",
  75. lll : "YYYY [m.] MMMM D [d.], LT [val.]",
  76. llll : "YYYY [m.] MMMM D [d.], ddd, LT [val.]"
  77. },
  78. calendar : {
  79. sameDay : "[Šiandien] LT",
  80. nextDay : "[Rytoj] LT",
  81. nextWeek : "dddd LT",
  82. lastDay : "[Vakar] LT",
  83. lastWeek : "[Praėjusį] dddd LT",
  84. sameElse : "L"
  85. },
  86. relativeTime : {
  87. future : "po %s",
  88. past : "prieš %s",
  89. s : translateSeconds,
  90. m : translateSingular,
  91. mm : translate,
  92. h : translateSingular,
  93. hh : translate,
  94. d : translateSingular,
  95. dd : translate,
  96. M : translateSingular,
  97. MM : translate,
  98. y : translateSingular,
  99. yy : translate
  100. },
  101. ordinal : function (number) {
  102. return number + '-oji';
  103. },
  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. }));