lb.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //! moment.js locale configuration
  2. ;(function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined'
  4. && typeof require === 'function' ? factory(require('../moment')) :
  5. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  6. factory(global.moment)
  7. }(this, (function (moment) { 'use strict';
  8. function processRelativeTime(number, withoutSuffix, key, isFuture) {
  9. var format = {
  10. 'm': ['eng Minutt', 'enger Minutt'],
  11. 'h': ['eng Stonn', 'enger Stonn'],
  12. 'd': ['een Dag', 'engem Dag'],
  13. 'M': ['ee Mount', 'engem Mount'],
  14. 'y': ['ee Joer', 'engem Joer']
  15. };
  16. return withoutSuffix ? format[key][0] : format[key][1];
  17. }
  18. function processFutureTime(string) {
  19. var number = string.substr(0, string.indexOf(' '));
  20. if (eifelerRegelAppliesToNumber(number)) {
  21. return 'a ' + string;
  22. }
  23. return 'an ' + string;
  24. }
  25. function processPastTime(string) {
  26. var number = string.substr(0, string.indexOf(' '));
  27. if (eifelerRegelAppliesToNumber(number)) {
  28. return 'viru ' + string;
  29. }
  30. return 'virun ' + string;
  31. }
  32. /**
  33. * Returns true if the word before the given number loses the '-n' ending.
  34. * e.g. 'an 10 Deeg' but 'a 5 Deeg'
  35. *
  36. * @param number {integer}
  37. * @returns {boolean}
  38. */
  39. function eifelerRegelAppliesToNumber(number) {
  40. number = parseInt(number, 10);
  41. if (isNaN(number)) {
  42. return false;
  43. }
  44. if (number < 0) {
  45. // Negative Number --> always true
  46. return true;
  47. } else if (number < 10) {
  48. // Only 1 digit
  49. if (4 <= number && number <= 7) {
  50. return true;
  51. }
  52. return false;
  53. } else if (number < 100) {
  54. // 2 digits
  55. var lastDigit = number % 10, firstDigit = number / 10;
  56. if (lastDigit === 0) {
  57. return eifelerRegelAppliesToNumber(firstDigit);
  58. }
  59. return eifelerRegelAppliesToNumber(lastDigit);
  60. } else if (number < 10000) {
  61. // 3 or 4 digits --> recursively check first digit
  62. while (number >= 10) {
  63. number = number / 10;
  64. }
  65. return eifelerRegelAppliesToNumber(number);
  66. } else {
  67. // Anything larger than 4 digits: recursively check first n-3 digits
  68. number = number / 1000;
  69. return eifelerRegelAppliesToNumber(number);
  70. }
  71. }
  72. var lb = moment.defineLocale('lb', {
  73. months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
  74. monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
  75. monthsParseExact : true,
  76. weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'),
  77. weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
  78. weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
  79. weekdaysParseExact : true,
  80. longDateFormat: {
  81. LT: 'H:mm [Auer]',
  82. LTS: 'H:mm:ss [Auer]',
  83. L: 'DD.MM.YYYY',
  84. LL: 'D. MMMM YYYY',
  85. LLL: 'D. MMMM YYYY H:mm [Auer]',
  86. LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]'
  87. },
  88. calendar: {
  89. sameDay: '[Haut um] LT',
  90. sameElse: 'L',
  91. nextDay: '[Muer um] LT',
  92. nextWeek: 'dddd [um] LT',
  93. lastDay: '[Gëschter um] LT',
  94. lastWeek: function () {
  95. // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
  96. switch (this.day()) {
  97. case 2:
  98. case 4:
  99. return '[Leschten] dddd [um] LT';
  100. default:
  101. return '[Leschte] dddd [um] LT';
  102. }
  103. }
  104. },
  105. relativeTime : {
  106. future : processFutureTime,
  107. past : processPastTime,
  108. s : 'e puer Sekonnen',
  109. ss : '%d Sekonnen',
  110. m : processRelativeTime,
  111. mm : '%d Minutten',
  112. h : processRelativeTime,
  113. hh : '%d Stonnen',
  114. d : processRelativeTime,
  115. dd : '%d Deeg',
  116. M : processRelativeTime,
  117. MM : '%d Méint',
  118. y : processRelativeTime,
  119. yy : '%d Joer'
  120. },
  121. dayOfMonthOrdinalParse: /\d{1,2}\./,
  122. ordinal: '%d.',
  123. week: {
  124. dow: 1, // Monday is the first day of the week.
  125. doy: 4 // The week that contains Jan 4th is the first week of the year.
  126. }
  127. });
  128. return lb;
  129. })));