lb.js (4269B)
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 6import moment from '../moment'; 7 8function 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} 18function processFutureTime(string) { 19 var number = string.substr(0, string.indexOf(' ')); 20 if (eifelerRegelAppliesToNumber(number)) { 21 return 'a ' + string; 22 } 23 return 'an ' + string; 24} 25function 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 */ 39function 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, 56 firstDigit = number / 10; 57 if (lastDigit === 0) { 58 return eifelerRegelAppliesToNumber(firstDigit); 59 } 60 return eifelerRegelAppliesToNumber(lastDigit); 61 } else if (number < 10000) { 62 // 3 or 4 digits --> recursively check first digit 63 while (number >= 10) { 64 number = number / 10; 65 } 66 return eifelerRegelAppliesToNumber(number); 67 } else { 68 // Anything larger than 4 digits: recursively check first n-3 digits 69 number = number / 1000; 70 return eifelerRegelAppliesToNumber(number); 71 } 72} 73 74export default moment.defineLocale('lb', { 75 months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split( 76 '_' 77 ), 78 monthsShort: 79 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split( 80 '_' 81 ), 82 monthsParseExact: true, 83 weekdays: 84 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split( 85 '_' 86 ), 87 weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), 88 weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), 89 weekdaysParseExact: true, 90 longDateFormat: { 91 LT: 'H:mm [Auer]', 92 LTS: 'H:mm:ss [Auer]', 93 L: 'DD.MM.YYYY', 94 LL: 'D. MMMM YYYY', 95 LLL: 'D. MMMM YYYY H:mm [Auer]', 96 LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]', 97 }, 98 calendar: { 99 sameDay: '[Haut um] LT', 100 sameElse: 'L', 101 nextDay: '[Muer um] LT', 102 nextWeek: 'dddd [um] LT', 103 lastDay: '[Gëschter um] LT', 104 lastWeek: function () { 105 // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule 106 switch (this.day()) { 107 case 2: 108 case 4: 109 return '[Leschten] dddd [um] LT'; 110 default: 111 return '[Leschte] dddd [um] LT'; 112 } 113 }, 114 }, 115 relativeTime: { 116 future: processFutureTime, 117 past: processPastTime, 118 s: 'e puer Sekonnen', 119 ss: '%d Sekonnen', 120 m: processRelativeTime, 121 mm: '%d Minutten', 122 h: processRelativeTime, 123 hh: '%d Stonnen', 124 d: processRelativeTime, 125 dd: '%d Deeg', 126 M: processRelativeTime, 127 MM: '%d Méint', 128 y: processRelativeTime, 129 yy: '%d Joer', 130 }, 131 dayOfMonthOrdinalParse: /\d{1,2}\./, 132 ordinal: '%d.', 133 week: { 134 dow: 1, // Monday is the first day of the week. 135 doy: 4, // The week that contains Jan 4th is the first week of the year. 136 }, 137});