lb.js 4.8 KB

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