lb.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split(
  82. '_'
  83. ),
  84. monthsParseExact: true,
  85. weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split(
  86. '_'
  87. ),
  88. weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
  89. weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
  90. weekdaysParseExact: true,
  91. longDateFormat: {
  92. LT: 'H:mm [Auer]',
  93. LTS: 'H:mm:ss [Auer]',
  94. L: 'DD.MM.YYYY',
  95. LL: 'D. MMMM YYYY',
  96. LLL: 'D. MMMM YYYY H:mm [Auer]',
  97. LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]',
  98. },
  99. calendar: {
  100. sameDay: '[Haut um] LT',
  101. sameElse: 'L',
  102. nextDay: '[Muer um] LT',
  103. nextWeek: 'dddd [um] LT',
  104. lastDay: '[Gëschter um] LT',
  105. lastWeek: function () {
  106. // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
  107. switch (this.day()) {
  108. case 2:
  109. case 4:
  110. return '[Leschten] dddd [um] LT';
  111. default:
  112. return '[Leschte] dddd [um] LT';
  113. }
  114. },
  115. },
  116. relativeTime: {
  117. future: processFutureTime,
  118. past: processPastTime,
  119. s: 'e puer Sekonnen',
  120. ss: '%d Sekonnen',
  121. m: processRelativeTime,
  122. mm: '%d Minutten',
  123. h: processRelativeTime,
  124. hh: '%d Stonnen',
  125. d: processRelativeTime,
  126. dd: '%d Deeg',
  127. M: processRelativeTime,
  128. MM: '%d Méint',
  129. y: processRelativeTime,
  130. yy: '%d Joer',
  131. },
  132. dayOfMonthOrdinalParse: /\d{1,2}\./,
  133. ordinal: '%d.',
  134. week: {
  135. dow: 1, // Monday is the first day of the week.
  136. doy: 4, // The week that contains Jan 4th is the first week of the year.
  137. },
  138. });
  139. return lb;
  140. })));