123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- "use strict";
- exports.localize = void 0;
- var _index = require("../../_lib/buildLocalizeFn.cjs");
- const eraValues = {
- narrow: ["B", "A"],
- abbreviated: ["BC", "AD"],
- wide: ["Before Christ", "Anno Domini"],
- };
- const quarterValues = {
- narrow: ["1", "2", "3", "4"],
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
- };
- // Note: in English, the names of days of the week and months are capitalized.
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
- // Generally, formatted dates should look like they are in the middle of a sentence,
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
- const monthValues = {
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
- abbreviated: [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
- ],
- wide: [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December",
- ],
- };
- const dayValues = {
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- wide: [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- ],
- };
- const dayPeriodValues = {
- narrow: {
- am: "a",
- pm: "p",
- midnight: "mi",
- noon: "n",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night",
- },
- abbreviated: {
- am: "AM",
- pm: "PM",
- midnight: "midnight",
- noon: "noon",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night",
- },
- wide: {
- am: "a.m.",
- pm: "p.m.",
- midnight: "midnight",
- noon: "noon",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night",
- },
- };
- const formattingDayPeriodValues = {
- narrow: {
- am: "a",
- pm: "p",
- midnight: "mi",
- noon: "n",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night",
- },
- abbreviated: {
- am: "AM",
- pm: "PM",
- midnight: "midnight",
- noon: "noon",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night",
- },
- wide: {
- am: "a.m.",
- pm: "p.m.",
- midnight: "midnight",
- noon: "noon",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night",
- },
- };
- const ordinalNumber = (dirtyNumber, _options) => {
- const number = Number(dirtyNumber);
- // If ordinal numbers depend on context, for example,
- // if they are different for different grammatical genders,
- // use `options.unit`.
- //
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
- // 'day', 'hour', 'minute', 'second'.
- const rem100 = number % 100;
- if (rem100 > 20 || rem100 < 10) {
- switch (rem100 % 10) {
- case 1:
- return number + "st";
- case 2:
- return number + "nd";
- case 3:
- return number + "rd";
- }
- }
- return number + "th";
- };
- const localize = (exports.localize = {
- ordinalNumber,
- era: (0, _index.buildLocalizeFn)({
- values: eraValues,
- defaultWidth: "wide",
- }),
- quarter: (0, _index.buildLocalizeFn)({
- values: quarterValues,
- defaultWidth: "wide",
- argumentCallback: (quarter) => quarter - 1,
- }),
- month: (0, _index.buildLocalizeFn)({
- values: monthValues,
- defaultWidth: "wide",
- }),
- day: (0, _index.buildLocalizeFn)({
- values: dayValues,
- defaultWidth: "wide",
- }),
- dayPeriod: (0, _index.buildLocalizeFn)({
- values: dayPeriodValues,
- defaultWidth: "wide",
- formattingValues: formattingDayPeriodValues,
- defaultFormattingWidth: "wide",
- }),
- });
|