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