165 lines
3.0 KiB
JavaScript
165 lines
3.0 KiB
JavaScript
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.mjs";
|
|
|
|
const eraValues = {
|
|
narrow: ["AC", "DC"],
|
|
abbreviated: ["AC", "DC"],
|
|
wide: ["antes de cristo", "después de cristo"],
|
|
};
|
|
|
|
const quarterValues = {
|
|
narrow: ["1", "2", "3", "4"],
|
|
abbreviated: ["T1", "T2", "T3", "T4"],
|
|
wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"],
|
|
};
|
|
|
|
const monthValues = {
|
|
narrow: ["e", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
|
|
abbreviated: [
|
|
"ene",
|
|
"feb",
|
|
"mar",
|
|
"abr",
|
|
"may",
|
|
"jun",
|
|
"jul",
|
|
"ago",
|
|
"sep",
|
|
"oct",
|
|
"nov",
|
|
"dic",
|
|
],
|
|
|
|
wide: [
|
|
"enero",
|
|
"febrero",
|
|
"marzo",
|
|
"abril",
|
|
"mayo",
|
|
"junio",
|
|
"julio",
|
|
"agosto",
|
|
"septiembre",
|
|
"octubre",
|
|
"noviembre",
|
|
"diciembre",
|
|
],
|
|
};
|
|
|
|
const dayValues = {
|
|
narrow: ["d", "l", "m", "m", "j", "v", "s"],
|
|
short: ["do", "lu", "ma", "mi", "ju", "vi", "sá"],
|
|
abbreviated: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
|
|
wide: [
|
|
"domingo",
|
|
"lunes",
|
|
"martes",
|
|
"miércoles",
|
|
"jueves",
|
|
"viernes",
|
|
"sábado",
|
|
],
|
|
};
|
|
|
|
const dayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mn",
|
|
noon: "md",
|
|
morning: "mañana",
|
|
afternoon: "tarde",
|
|
evening: "tarde",
|
|
night: "noche",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "medianoche",
|
|
noon: "mediodia",
|
|
morning: "mañana",
|
|
afternoon: "tarde",
|
|
evening: "tarde",
|
|
night: "noche",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "medianoche",
|
|
noon: "mediodia",
|
|
morning: "mañana",
|
|
afternoon: "tarde",
|
|
evening: "tarde",
|
|
night: "noche",
|
|
},
|
|
};
|
|
|
|
const formattingDayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mn",
|
|
noon: "md",
|
|
morning: "de la mañana",
|
|
afternoon: "de la tarde",
|
|
evening: "de la tarde",
|
|
night: "de la noche",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "medianoche",
|
|
noon: "mediodia",
|
|
morning: "de la mañana",
|
|
afternoon: "de la tarde",
|
|
evening: "de la tarde",
|
|
night: "de la noche",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "medianoche",
|
|
noon: "mediodia",
|
|
morning: "de la mañana",
|
|
afternoon: "de la tarde",
|
|
evening: "de la tarde",
|
|
night: "de la noche",
|
|
},
|
|
};
|
|
|
|
const ordinalNumber = (dirtyNumber, _options) => {
|
|
const number = Number(dirtyNumber);
|
|
return number + "º";
|
|
};
|
|
|
|
export const localize = {
|
|
ordinalNumber: ordinalNumber,
|
|
|
|
era: buildLocalizeFn({
|
|
values: eraValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
quarter: buildLocalizeFn({
|
|
values: quarterValues,
|
|
defaultWidth: "wide",
|
|
argumentCallback: (quarter) => Number(quarter) - 1,
|
|
}),
|
|
|
|
month: buildLocalizeFn({
|
|
values: monthValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
day: buildLocalizeFn({
|
|
values: dayValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
dayPeriod: buildLocalizeFn({
|
|
values: dayPeriodValues,
|
|
defaultWidth: "wide",
|
|
formattingValues: formattingDayPeriodValues,
|
|
defaultFormattingWidth: "wide",
|
|
}),
|
|
};
|