169 lines
3.3 KiB
JavaScript
169 lines
3.3 KiB
JavaScript
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.mjs";
|
|
|
|
const eraValues = {
|
|
narrow: ["fvt", "vt"],
|
|
abbreviated: ["f.v.t.", "v.t."],
|
|
wide: ["før vesterlandsk tidsregning", "vesterlandsk tidsregning"],
|
|
};
|
|
|
|
const quarterValues = {
|
|
narrow: ["1", "2", "3", "4"],
|
|
abbreviated: ["1. kvt.", "2. kvt.", "3. kvt.", "4. kvt."],
|
|
wide: ["1. kvartal", "2. kvartal", "3. kvartal", "4. kvartal"],
|
|
};
|
|
|
|
const monthValues = {
|
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
abbreviated: [
|
|
"jan.",
|
|
"feb.",
|
|
"mar.",
|
|
"apr.",
|
|
"maj",
|
|
"jun.",
|
|
"jul.",
|
|
"aug.",
|
|
"sep.",
|
|
"okt.",
|
|
"nov.",
|
|
"dec.",
|
|
],
|
|
|
|
wide: [
|
|
"januar",
|
|
"februar",
|
|
"marts",
|
|
"april",
|
|
"maj",
|
|
"juni",
|
|
"juli",
|
|
"august",
|
|
"september",
|
|
"oktober",
|
|
"november",
|
|
"december",
|
|
],
|
|
};
|
|
|
|
// Note that 'Days - abbreviated - Formatting' has periods at the end.
|
|
// https://www.unicode.org/cldr/charts/32/summary/da.html#1760
|
|
// This makes grammatical sense in danish, as most abbreviations have periods.
|
|
const dayValues = {
|
|
narrow: ["S", "M", "T", "O", "T", "F", "L"],
|
|
short: ["sø", "ma", "ti", "on", "to", "fr", "lø"],
|
|
abbreviated: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."],
|
|
|
|
wide: [
|
|
"søndag",
|
|
"mandag",
|
|
"tirsdag",
|
|
"onsdag",
|
|
"torsdag",
|
|
"fredag",
|
|
"lørdag",
|
|
],
|
|
};
|
|
|
|
const dayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "morgen",
|
|
afternoon: "eftermiddag",
|
|
evening: "aften",
|
|
night: "nat",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "morgen",
|
|
afternoon: "eftermiddag",
|
|
evening: "aften",
|
|
night: "nat",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "morgen",
|
|
afternoon: "eftermiddag",
|
|
evening: "aften",
|
|
night: "nat",
|
|
},
|
|
};
|
|
|
|
const formattingDayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "om morgenen",
|
|
afternoon: "om eftermiddagen",
|
|
evening: "om aftenen",
|
|
night: "om natten",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "om morgenen",
|
|
afternoon: "om eftermiddagen",
|
|
evening: "om aftenen",
|
|
night: "om natten",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnat",
|
|
noon: "middag",
|
|
morning: "om morgenen",
|
|
afternoon: "om eftermiddagen",
|
|
evening: "om aftenen",
|
|
night: "om natten",
|
|
},
|
|
};
|
|
|
|
const ordinalNumber = (dirtyNumber, _options) => {
|
|
const number = Number(dirtyNumber);
|
|
return number + ".";
|
|
};
|
|
|
|
export const localize = {
|
|
ordinalNumber,
|
|
|
|
era: buildLocalizeFn({
|
|
values: eraValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
quarter: buildLocalizeFn({
|
|
values: quarterValues,
|
|
defaultWidth: "wide",
|
|
argumentCallback: (quarter) => quarter - 1,
|
|
}),
|
|
|
|
month: buildLocalizeFn({
|
|
values: monthValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
day: buildLocalizeFn({
|
|
values: dayValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
dayPeriod: buildLocalizeFn({
|
|
values: dayPeriodValues,
|
|
defaultWidth: "wide",
|
|
formattingValues: formattingDayPeriodValues,
|
|
defaultFormattingWidth: "wide",
|
|
}),
|
|
};
|