mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
bb2bdad8e0
We keep previous version, just in case.
160 lines
5.5 KiB
JavaScript
160 lines
5.5 KiB
JavaScript
// moment.js language configuration
|
|
// language : Luxembourgish (lb)
|
|
// author : mweimerskirch : https://github.com/mweimerskirch
|
|
|
|
// Note: Luxembourgish has a very particular phonological rule ("Eifeler Regel") that causes the
|
|
// deletion of the final "n" in certain contexts. That's what the "eifelerRegelAppliesToWeekday"
|
|
// and "eifelerRegelAppliesToNumber" methods are meant for
|
|
|
|
(function (factory) {
|
|
if (typeof define === 'function' && define.amd) {
|
|
define(['moment'], factory); // AMD
|
|
} else if (typeof exports === 'object') {
|
|
module.exports = factory(require('../moment')); // Node
|
|
} else {
|
|
factory(window.moment); // Browser global
|
|
}
|
|
}(function (moment) {
|
|
function processRelativeTime(number, withoutSuffix, key, isFuture) {
|
|
var format = {
|
|
'm': ['eng Minutt', 'enger Minutt'],
|
|
'h': ['eng Stonn', 'enger Stonn'],
|
|
'd': ['een Dag', 'engem Dag'],
|
|
'dd': [number + ' Deeg', number + ' Deeg'],
|
|
'M': ['ee Mount', 'engem Mount'],
|
|
'MM': [number + ' Méint', number + ' Méint'],
|
|
'y': ['ee Joer', 'engem Joer'],
|
|
'yy': [number + ' Joer', number + ' Joer']
|
|
};
|
|
return withoutSuffix ? format[key][0] : format[key][1];
|
|
}
|
|
|
|
function processFutureTime(string) {
|
|
var number = string.substr(0, string.indexOf(' '));
|
|
if (eifelerRegelAppliesToNumber(number)) {
|
|
return "a " + string;
|
|
}
|
|
return "an " + string;
|
|
}
|
|
|
|
function processPastTime(string) {
|
|
var number = string.substr(0, string.indexOf(' '));
|
|
if (eifelerRegelAppliesToNumber(number)) {
|
|
return "viru " + string;
|
|
}
|
|
return "virun " + string;
|
|
}
|
|
|
|
function processLastWeek(string1) {
|
|
var weekday = this.format('d');
|
|
if (eifelerRegelAppliesToWeekday(weekday)) {
|
|
return '[Leschte] dddd [um] LT';
|
|
}
|
|
return '[Leschten] dddd [um] LT';
|
|
}
|
|
|
|
/**
|
|
* Returns true if the word before the given week day loses the "-n" ending.
|
|
* e.g. "Leschten Dënschdeg" but "Leschte Méindeg"
|
|
*
|
|
* @param weekday {integer}
|
|
* @returns {boolean}
|
|
*/
|
|
function eifelerRegelAppliesToWeekday(weekday) {
|
|
weekday = parseInt(weekday, 10);
|
|
switch (weekday) {
|
|
case 0: // Sonndeg
|
|
case 1: // Méindeg
|
|
case 3: // Mëttwoch
|
|
case 5: // Freideg
|
|
case 6: // Samschdeg
|
|
return true;
|
|
default: // 2 Dënschdeg, 4 Donneschdeg
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns true if the word before the given number loses the "-n" ending.
|
|
* e.g. "an 10 Deeg" but "a 5 Deeg"
|
|
*
|
|
* @param number {integer}
|
|
* @returns {boolean}
|
|
*/
|
|
function eifelerRegelAppliesToNumber(number) {
|
|
number = parseInt(number, 10);
|
|
if (isNaN(number)) {
|
|
return false;
|
|
}
|
|
if (number < 0) {
|
|
// Negative Number --> always true
|
|
return true;
|
|
} else if (number < 10) {
|
|
// Only 1 digit
|
|
if (4 <= number && number <= 7) {
|
|
return true;
|
|
}
|
|
return false;
|
|
} else if (number < 100) {
|
|
// 2 digits
|
|
var lastDigit = number % 10, firstDigit = number / 10;
|
|
if (lastDigit === 0) {
|
|
return eifelerRegelAppliesToNumber(firstDigit);
|
|
}
|
|
return eifelerRegelAppliesToNumber(lastDigit);
|
|
} else if (number < 10000) {
|
|
// 3 or 4 digits --> recursively check first digit
|
|
while (number >= 10) {
|
|
number = number / 10;
|
|
}
|
|
return eifelerRegelAppliesToNumber(number);
|
|
} else {
|
|
// Anything larger than 4 digits: recursively check first n-3 digits
|
|
number = number / 1000;
|
|
return eifelerRegelAppliesToNumber(number);
|
|
}
|
|
}
|
|
|
|
return moment.lang('lb', {
|
|
months: "Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
|
|
monthsShort: "Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
|
|
weekdays: "Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),
|
|
weekdaysShort: "So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),
|
|
weekdaysMin: "So_Mé_Dë_Më_Do_Fr_Sa".split("_"),
|
|
longDateFormat: {
|
|
LT: "H:mm [Auer]",
|
|
L: "DD.MM.YYYY",
|
|
LL: "D. MMMM YYYY",
|
|
LLL: "D. MMMM YYYY LT",
|
|
LLLL: "dddd, D. MMMM YYYY LT"
|
|
},
|
|
calendar: {
|
|
sameDay: "[Haut um] LT",
|
|
sameElse: "L",
|
|
nextDay: '[Muer um] LT',
|
|
nextWeek: 'dddd [um] LT',
|
|
lastDay: '[Gëschter um] LT',
|
|
lastWeek: processLastWeek
|
|
},
|
|
relativeTime: {
|
|
future: processFutureTime,
|
|
past: processPastTime,
|
|
s: "e puer Sekonnen",
|
|
m: processRelativeTime,
|
|
mm: "%d Minutten",
|
|
h: processRelativeTime,
|
|
hh: "%d Stonnen",
|
|
d: processRelativeTime,
|
|
dd: processRelativeTime,
|
|
M: processRelativeTime,
|
|
MM: processRelativeTime,
|
|
y: processRelativeTime,
|
|
yy: processRelativeTime
|
|
},
|
|
ordinal: '%d.',
|
|
week: {
|
|
dow: 1, // Monday is the first day of the week.
|
|
doy: 4 // The week that contains Jan 4th is the first week of the year.
|
|
}
|
|
});
|
|
}));
|