lv.js 3.9 KB

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