lv.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // moment.js locale configuration
  2. // locale : 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((typeof global !== 'undefined' ? global : this).moment); // node or other 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.defineLocale('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. LTS : 'LT:ss',
  40. L : 'DD.MM.YYYY',
  41. LL : 'YYYY. [gada] D. MMMM',
  42. LLL : 'YYYY. [gada] D. MMMM, LT',
  43. LLLL : 'YYYY. [gada] D. MMMM, dddd, LT'
  44. },
  45. calendar : {
  46. sameDay : '[Šodien pulksten] LT',
  47. nextDay : '[Rīt pulksten] LT',
  48. nextWeek : 'dddd [pulksten] LT',
  49. lastDay : '[Vakar pulksten] LT',
  50. lastWeek : '[Pagājušā] dddd [pulksten] LT',
  51. sameElse : 'L'
  52. },
  53. relativeTime : {
  54. future : '%s vēlāk',
  55. past : '%s agrāk',
  56. s : 'dažas sekundes',
  57. m : 'minūti',
  58. mm : relativeTimeWithPlural,
  59. h : 'stundu',
  60. hh : relativeTimeWithPlural,
  61. d : 'dienu',
  62. dd : relativeTimeWithPlural,
  63. M : 'mēnesi',
  64. MM : relativeTimeWithPlural,
  65. y : 'gadu',
  66. yy : relativeTimeWithPlural
  67. },
  68. ordinalParse: /\d{1,2}\./,
  69. ordinal : '%d.',
  70. week : {
  71. dow : 1, // Monday is the first day of the week.
  72. doy : 4 // The week that contains Jan 4th is the first week of the year.
  73. }
  74. });
  75. }));