lv.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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:
  53. 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split(
  54. '_'
  55. ),
  56. weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'),
  57. weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'),
  58. weekdaysParseExact: true,
  59. longDateFormat: {
  60. LT: 'HH:mm',
  61. LTS: 'HH:mm:ss',
  62. L: 'DD.MM.YYYY.',
  63. LL: 'YYYY. [gada] D. MMMM',
  64. LLL: 'YYYY. [gada] D. MMMM, HH:mm',
  65. LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm',
  66. },
  67. calendar: {
  68. sameDay: '[Šodien pulksten] LT',
  69. nextDay: '[Rīt pulksten] LT',
  70. nextWeek: 'dddd [pulksten] LT',
  71. lastDay: '[Vakar pulksten] LT',
  72. lastWeek: '[Pagājušā] dddd [pulksten] LT',
  73. sameElse: 'L',
  74. },
  75. relativeTime: {
  76. future: 'pēc %s',
  77. past: 'pirms %s',
  78. s: relativeSeconds,
  79. ss: relativeTimeWithPlural,
  80. m: relativeTimeWithSingular,
  81. mm: relativeTimeWithPlural,
  82. h: relativeTimeWithSingular,
  83. hh: relativeTimeWithPlural,
  84. d: relativeTimeWithSingular,
  85. dd: relativeTimeWithPlural,
  86. M: relativeTimeWithSingular,
  87. MM: relativeTimeWithPlural,
  88. y: relativeTimeWithSingular,
  89. yy: relativeTimeWithPlural,
  90. },
  91. dayOfMonthOrdinalParse: /\d{1,2}\./,
  92. ordinal: '%d.',
  93. week: {
  94. dow: 1, // Monday is the first day of the week.
  95. doy: 4, // The week that contains Jan 4th is the first week of the year.
  96. },
  97. });
  98. return lv;
  99. })));