lb.js 5.0 KB

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