lv.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //! moment.js locale configuration
  2. //! locale : Latvian [lv]
  3. //! author : Kristaps Karlsons : https://github.com/skakri
  4. //! author : Jānis Elmeris : https://github.com/JanisE
  5. ;(function (global, factory) {
  6. typeof exports === 'object' && typeof module !== 'undefined'
  7. && typeof require === 'function' ? factory(require('../moment')) :
  8. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  9. factory(global.moment)
  10. }(this, (function (moment) { 'use strict';
  11. //! moment.js locale configuration
  12. var units = {
  13. ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'),
  14. m: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  15. mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  16. h: 'stundas_stundām_stunda_stundas'.split('_'),
  17. hh: 'stundas_stundām_stunda_stundas'.split('_'),
  18. d: 'dienas_dienām_diena_dienas'.split('_'),
  19. dd: 'dienas_dienām_diena_dienas'.split('_'),
  20. M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  21. MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  22. y: 'gada_gadiem_gads_gadi'.split('_'),
  23. yy: 'gada_gadiem_gads_gadi'.split('_'),
  24. };
  25. /**
  26. * @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
  27. */
  28. function format(forms, number, withoutSuffix) {
  29. if (withoutSuffix) {
  30. // E.g. "21 minūte", "3 minūtes".
  31. return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3];
  32. } else {
  33. // E.g. "21 minūtes" as in "pēc 21 minūtes".
  34. // E.g. "3 minūtēm" as in "pēc 3 minūtēm".
  35. return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1];
  36. }
  37. }
  38. function relativeTimeWithPlural(number, withoutSuffix, key) {
  39. return number + ' ' + format(units[key], number, withoutSuffix);
  40. }
  41. function relativeTimeWithSingular(number, withoutSuffix, key) {
  42. return format(units[key], number, withoutSuffix);
  43. }
  44. function relativeSeconds(number, withoutSuffix) {
  45. return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
  46. }
  47. var lv = moment.defineLocale('lv', {
  48. months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split(
  49. '_'
  50. ),
  51. monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
  52. weekdays: 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split(
  53. '_'
  54. ),
  55. weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'),
  56. weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'),
  57. weekdaysParseExact: true,
  58. longDateFormat: {
  59. LT: 'HH:mm',
  60. LTS: 'HH:mm:ss',
  61. L: 'DD.MM.YYYY.',
  62. LL: 'YYYY. [gada] D. MMMM',
  63. LLL: 'YYYY. [gada] D. MMMM, HH:mm',
  64. LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm',
  65. },
  66. calendar: {
  67. sameDay: '[Šodien pulksten] LT',
  68. nextDay: '[Rīt pulksten] LT',
  69. nextWeek: 'dddd [pulksten] LT',
  70. lastDay: '[Vakar pulksten] LT',
  71. lastWeek: '[Pagājušā] dddd [pulksten] LT',
  72. sameElse: 'L',
  73. },
  74. relativeTime: {
  75. future: 'pēc %s',
  76. past: 'pirms %s',
  77. s: relativeSeconds,
  78. ss: relativeTimeWithPlural,
  79. m: relativeTimeWithSingular,
  80. mm: relativeTimeWithPlural,
  81. h: relativeTimeWithSingular,
  82. hh: relativeTimeWithPlural,
  83. d: relativeTimeWithSingular,
  84. dd: relativeTimeWithPlural,
  85. M: relativeTimeWithSingular,
  86. MM: relativeTimeWithPlural,
  87. y: relativeTimeWithSingular,
  88. yy: relativeTimeWithPlural,
  89. },
  90. dayOfMonthOrdinalParse: /\d{1,2}\./,
  91. ordinal: '%d.',
  92. week: {
  93. dow: 1, // Monday is the first day of the week.
  94. doy: 4, // The week that contains Jan 4th is the first week of the year.
  95. },
  96. });
  97. return lv;
  98. })));