lv.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // moment.js language configuration
  2. // language : latvian (lv)
  3. // author : Kristaps Karlsons : https://github.com/skakri
  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. 'mm': 'minūti_minūtes_minūte_minūtes',
  15. 'hh': 'stundu_stundas_stunda_stundas',
  16. 'dd': 'dienu_dienas_diena_dienas',
  17. 'MM': 'mēnesi_mēnešus_mēnesis_mēneši',
  18. 'yy': 'gadu_gadus_gads_gadi'
  19. };
  20. function format(word, number, withoutSuffix) {
  21. var forms = word.split('_');
  22. if (withoutSuffix) {
  23. return number % 10 === 1 && number !== 11 ? forms[2] : forms[3];
  24. } else {
  25. return number % 10 === 1 && number !== 11 ? forms[0] : forms[1];
  26. }
  27. }
  28. function relativeTimeWithPlural(number, withoutSuffix, key) {
  29. return number + ' ' + format(units[key], number, withoutSuffix);
  30. }
  31. return moment.lang('lv', {
  32. months : "janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),
  33. monthsShort : "jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),
  34. weekdays : "svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),
  35. weekdaysShort : "Sv_P_O_T_C_Pk_S".split("_"),
  36. weekdaysMin : "Sv_P_O_T_C_Pk_S".split("_"),
  37. longDateFormat : {
  38. LT : "HH:mm",
  39. L : "DD.MM.YYYY",
  40. LL : "YYYY. [gada] D. MMMM",
  41. LLL : "YYYY. [gada] D. MMMM, LT",
  42. LLLL : "YYYY. [gada] D. MMMM, dddd, LT"
  43. },
  44. calendar : {
  45. sameDay : '[Šodien pulksten] LT',
  46. nextDay : '[Rīt pulksten] LT',
  47. nextWeek : 'dddd [pulksten] LT',
  48. lastDay : '[Vakar pulksten] LT',
  49. lastWeek : '[Pagājušā] dddd [pulksten] LT',
  50. sameElse : 'L'
  51. },
  52. relativeTime : {
  53. future : "%s vēlāk",
  54. past : "%s agrāk",
  55. s : "dažas sekundes",
  56. m : "minūti",
  57. mm : relativeTimeWithPlural,
  58. h : "stundu",
  59. hh : relativeTimeWithPlural,
  60. d : "dienu",
  61. dd : relativeTimeWithPlural,
  62. M : "mēnesi",
  63. MM : relativeTimeWithPlural,
  64. y : "gadu",
  65. yy : relativeTimeWithPlural
  66. },
  67. ordinal : '%d.',
  68. week : {
  69. dow : 1, // Monday is the first day of the week.
  70. doy : 4 // The week that contains Jan 4th is the first week of the year.
  71. }
  72. });
  73. }));