1 // moment.js locale configuration
2 // locale : Luxembourgish (lb)
3 // author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz
5 // Note: Luxembourgish has a very particular phonological rule ('Eifeler Regel') that causes the
6 // deletion of the final 'n' in certain contexts. That's what the 'eifelerRegelAppliesToWeekday'
7 // and 'eifelerRegelAppliesToNumber' methods are meant for
10 if (typeof define
=== 'function' && define
.amd
) {
11 define(['moment'], factory
); // AMD
12 } else if (typeof exports
=== 'object') {
13 module
.exports
= factory(require('../moment')); // Node
15 factory((typeof global
!== 'undefined' ? global
: this).moment
); // node or other global
18 function processRelativeTime(number
, withoutSuffix
, key
, isFuture
) {
20 'm': ['eng Minutt', 'enger Minutt'],
21 'h': ['eng Stonn', 'enger Stonn'],
22 'd': ['een Dag', 'engem Dag'],
23 'M': ['ee Mount', 'engem Mount'],
24 'y': ['ee Joer', 'engem Joer']
26 return withoutSuffix
? format
[key
][0] : format
[key
][1];
29 function processFutureTime(string
) {
30 var number
= string
.substr(0, string
.indexOf(' '));
31 if (eifelerRegelAppliesToNumber(number
)) {
34 return 'an ' + string
;
37 function processPastTime(string
) {
38 var number
= string
.substr(0, string
.indexOf(' '));
39 if (eifelerRegelAppliesToNumber(number
)) {
40 return 'viru ' + string
;
42 return 'virun ' + string
;
46 * Returns true if the word before the given number loses the '-n' ending.
47 * e.g. 'an 10 Deeg' but 'a 5 Deeg'
49 * @param number {integer}
52 function eifelerRegelAppliesToNumber(number
) {
53 number
= parseInt(number
, 10);
58 // Negative Number --> always true
60 } else if (number
< 10) {
62 if (4 <= number
&& number
<= 7) {
66 } else if (number
< 100) {
68 var lastDigit
= number
% 10, firstDigit
= number
/ 10;
69 if (lastDigit
=== 0) {
70 return eifelerRegelAppliesToNumber(firstDigit
);
72 return eifelerRegelAppliesToNumber(lastDigit
);
73 } else if (number
< 10000) {
74 // 3 or 4 digits --> recursively check first digit
75 while (number
>= 10) {
78 return eifelerRegelAppliesToNumber(number
);
80 // Anything larger than 4 digits: recursively check first n-3 digits
81 number
= number
/ 1000;
82 return eifelerRegelAppliesToNumber(number
);
86 return moment
.defineLocale('lb', {
87 months
: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
88 monthsShort
: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
89 weekdays
: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'),
90 weekdaysShort
: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
91 weekdaysMin
: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
94 LTS
: 'H:mm:ss [Auer]',
97 LLL
: 'D. MMMM YYYY LT',
98 LLLL
: 'dddd, D. MMMM YYYY LT'
101 sameDay
: '[Haut um] LT',
103 nextDay
: '[Muer um] LT',
104 nextWeek
: 'dddd [um] LT',
105 lastDay
: '[Gëschter um] LT',
106 lastWeek: function () {
107 // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
108 switch (this.day()) {
111 return '[Leschten] dddd [um] LT';
113 return '[Leschte] dddd [um] LT';
118 future
: processFutureTime
,
119 past
: processPastTime
,
120 s
: 'e puer Sekonnen',
121 m
: processRelativeTime
,
123 h
: processRelativeTime
,
125 d
: processRelativeTime
,
127 M
: processRelativeTime
,
129 y
: processRelativeTime
,
132 ordinalParse
: /\d{1,2}\./,
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.