1/5/1404
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
export function buildFormatLongFn(args) {
|
||||
return (options = {}) => {
|
||||
// TODO: Remove String()
|
||||
const width = options.width ? String(options.width) : args.defaultWidth;
|
||||
const format = args.formats[width] || args.formats[args.defaultWidth];
|
||||
return format;
|
||||
};
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* The localize function argument callback which allows to convert raw value to
|
||||
* the actual type.
|
||||
*
|
||||
* @param value - The value to convert
|
||||
*
|
||||
* @returns The converted value
|
||||
*/
|
||||
|
||||
/**
|
||||
* The map of localized values for each width.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The index type of the locale unit value. It types conversion of units of
|
||||
* values that don't start at 0 (i.e. quarters).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Converts the unit value to the tuple of values.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The tuple of localized era values. The first element represents BC,
|
||||
* the second element represents AD.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The tuple of localized quarter values. The first element represents Q1.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The tuple of localized day values. The first element represents Sunday.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The tuple of localized month values. The first element represents January.
|
||||
*/
|
||||
|
||||
export function buildLocalizeFn(args) {
|
||||
return (value, options) => {
|
||||
const context = options?.context ? String(options.context) : "standalone";
|
||||
|
||||
let valuesArray;
|
||||
if (context === "formatting" && args.formattingValues) {
|
||||
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
||||
const width = options?.width ? String(options.width) : defaultWidth;
|
||||
|
||||
valuesArray =
|
||||
args.formattingValues[width] || args.formattingValues[defaultWidth];
|
||||
} else {
|
||||
const defaultWidth = args.defaultWidth;
|
||||
const width = options?.width ? String(options.width) : args.defaultWidth;
|
||||
|
||||
valuesArray = args.values[width] || args.values[defaultWidth];
|
||||
}
|
||||
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
||||
|
||||
// @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
||||
return valuesArray[index];
|
||||
};
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
export function buildMatchFn(args) {
|
||||
return (string, options = {}) => {
|
||||
const width = options.width;
|
||||
|
||||
const matchPattern =
|
||||
(width && args.matchPatterns[width]) ||
|
||||
args.matchPatterns[args.defaultMatchWidth];
|
||||
const matchResult = string.match(matchPattern);
|
||||
|
||||
if (!matchResult) {
|
||||
return null;
|
||||
}
|
||||
const matchedString = matchResult[0];
|
||||
|
||||
const parsePatterns =
|
||||
(width && args.parsePatterns[width]) ||
|
||||
args.parsePatterns[args.defaultParseWidth];
|
||||
|
||||
const key = Array.isArray(parsePatterns)
|
||||
? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
|
||||
: // [TODO] -- I challenge you to fix the type
|
||||
findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
||||
|
||||
let value;
|
||||
|
||||
value = args.valueCallback ? args.valueCallback(key) : key;
|
||||
value = options.valueCallback
|
||||
? // [TODO] -- I challenge you to fix the type
|
||||
options.valueCallback(value)
|
||||
: value;
|
||||
|
||||
const rest = string.slice(matchedString.length);
|
||||
|
||||
return { value, rest };
|
||||
};
|
||||
}
|
||||
|
||||
function findKey(object, predicate) {
|
||||
for (const key in object) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(object, key) &&
|
||||
predicate(object[key])
|
||||
) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findIndex(array, predicate) {
|
||||
for (let key = 0; key < array.length; key++) {
|
||||
if (predicate(array[key])) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
export function buildMatchPatternFn(args) {
|
||||
return (string, options = {}) => {
|
||||
const matchResult = string.match(args.matchPattern);
|
||||
if (!matchResult) return null;
|
||||
const matchedString = matchResult[0];
|
||||
|
||||
const parseResult = string.match(args.parsePattern);
|
||||
if (!parseResult) return null;
|
||||
let value = args.valueCallback
|
||||
? args.valueCallback(parseResult[0])
|
||||
: parseResult[0];
|
||||
|
||||
// [TODO] I challenge you to fix the type
|
||||
value = options.valueCallback ? options.valueCallback(value) : value;
|
||||
|
||||
const rest = string.slice(matchedString.length);
|
||||
|
||||
return { value, rest };
|
||||
};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./af/_lib/formatDistance.js";
|
||||
import { formatLong } from "./af/_lib/formatLong.js";
|
||||
import { formatRelative } from "./af/_lib/formatRelative.js";
|
||||
import { localize } from "./af/_lib/localize.js";
|
||||
import { match } from "./af/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Afrikaans locale.
|
||||
* @language Afrikaans
|
||||
* @iso-639-2 afr
|
||||
* @author Marnus Weststrate [@marnusw](https://github.com/marnusw)
|
||||
*/
|
||||
export const af = {
|
||||
code: "af",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default af;
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "minder as 'n sekonde",
|
||||
other: "minder as {{count}} sekondes",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 sekonde",
|
||||
other: "{{count}} sekondes",
|
||||
},
|
||||
|
||||
halfAMinute: "'n halwe minuut",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "minder as 'n minuut",
|
||||
other: "minder as {{count}} minute",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "'n minuut",
|
||||
other: "{{count}} minute",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ongeveer 1 uur",
|
||||
other: "ongeveer {{count}} ure",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 uur",
|
||||
other: "{{count}} ure",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 dag",
|
||||
other: "{{count}} dae",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "ongeveer 1 week",
|
||||
other: "ongeveer {{count}} weke",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 week",
|
||||
other: "{{count}} weke",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "ongeveer 1 maand",
|
||||
other: "ongeveer {{count}} maande",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 maand",
|
||||
other: "{{count}} maande",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "ongeveer 1 jaar",
|
||||
other: "ongeveer {{count}} jaar",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 jaar",
|
||||
other: "{{count}} jaar",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "meer as 1 jaar",
|
||||
other: "meer as {{count}} jaar",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "byna 1 jaar",
|
||||
other: "byna {{count}} jaar",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "oor " + result;
|
||||
} else {
|
||||
return result + " gelede";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d MMMM yyyy",
|
||||
long: "d MMMM yyyy",
|
||||
medium: "d MMM yyyy",
|
||||
short: "yyyy/MM/dd",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss zzzz",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'om' {{time}}",
|
||||
long: "{{date}} 'om' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'verlede' eeee 'om' p",
|
||||
yesterday: "'gister om' p",
|
||||
today: "'vandag om' p",
|
||||
tomorrow: "'môre om' p",
|
||||
nextWeek: "eeee 'om' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["vC", "nC"],
|
||||
abbreviated: ["vC", "nC"],
|
||||
wide: ["voor Christus", "na Christus"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["K1", "K2", "K3", "K4"],
|
||||
wide: ["1ste kwartaal", "2de kwartaal", "3de kwartaal", "4de kwartaal"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
||||
abbreviated: [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mrt",
|
||||
"Apr",
|
||||
"Mei",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Okt",
|
||||
"Nov",
|
||||
"Des",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"Januarie",
|
||||
"Februarie",
|
||||
"Maart",
|
||||
"April",
|
||||
"Mei",
|
||||
"Junie",
|
||||
"Julie",
|
||||
"Augustus",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Desember",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["S", "M", "D", "W", "D", "V", "S"],
|
||||
short: ["So", "Ma", "Di", "Wo", "Do", "Vr", "Sa"],
|
||||
abbreviated: ["Son", "Maa", "Din", "Woe", "Don", "Vry", "Sat"],
|
||||
wide: [
|
||||
"Sondag",
|
||||
"Maandag",
|
||||
"Dinsdag",
|
||||
"Woensdag",
|
||||
"Donderdag",
|
||||
"Vrydag",
|
||||
"Saterdag",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "middaguur",
|
||||
morning: "oggend",
|
||||
afternoon: "middag",
|
||||
evening: "laat middag",
|
||||
night: "aand",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "middaguur",
|
||||
morning: "oggend",
|
||||
afternoon: "middag",
|
||||
evening: "laat middag",
|
||||
night: "aand",
|
||||
},
|
||||
wide: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "middaguur",
|
||||
morning: "oggend",
|
||||
afternoon: "middag",
|
||||
evening: "laat middag",
|
||||
night: "aand",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "uur die middag",
|
||||
morning: "uur die oggend",
|
||||
afternoon: "uur die middag",
|
||||
evening: "uur die aand",
|
||||
night: "uur die aand",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "uur die middag",
|
||||
morning: "uur die oggend",
|
||||
afternoon: "uur die middag",
|
||||
evening: "uur die aand",
|
||||
night: "uur die aand",
|
||||
},
|
||||
wide: {
|
||||
am: "vm",
|
||||
pm: "nm",
|
||||
midnight: "middernag",
|
||||
noon: "uur die middag",
|
||||
morning: "uur die oggend",
|
||||
afternoon: "uur die middag",
|
||||
evening: "uur die aand",
|
||||
night: "uur die aand",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const rem100 = number % 100;
|
||||
if (rem100 < 20) {
|
||||
switch (rem100) {
|
||||
case 1:
|
||||
case 8:
|
||||
return number + "ste";
|
||||
default:
|
||||
return number + "de";
|
||||
}
|
||||
}
|
||||
return number + "ste";
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(ste|de)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^([vn]\.? ?C\.?)/,
|
||||
abbreviated: /^([vn]\. ?C\.?)/,
|
||||
wide: /^((voor|na) Christus)/,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^v/, /^n/],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^K[1234]/i,
|
||||
wide: /^[1234](st|d)e kwartaal/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[jfmasond]/i,
|
||||
abbreviated: /^(Jan|Feb|Mrt|Apr|Mei|Jun|Jul|Aug|Sep|Okt|Nov|Dec)\.?/i,
|
||||
wide: /^(Januarie|Februarie|Maart|April|Mei|Junie|Julie|Augustus|September|Oktober|November|Desember)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^J/i,
|
||||
/^F/i,
|
||||
/^M/i,
|
||||
/^A/i,
|
||||
/^M/i,
|
||||
/^J/i,
|
||||
/^J/i,
|
||||
/^A/i,
|
||||
/^S/i,
|
||||
/^O/i,
|
||||
/^N/i,
|
||||
/^D/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^Jan/i,
|
||||
/^Feb/i,
|
||||
/^Mrt/i,
|
||||
/^Apr/i,
|
||||
/^Mei/i,
|
||||
/^Jun/i,
|
||||
/^Jul/i,
|
||||
/^Aug/i,
|
||||
/^Sep/i,
|
||||
/^Okt/i,
|
||||
/^Nov/i,
|
||||
/^Dec/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[smdwv]/i,
|
||||
short: /^(So|Ma|Di|Wo|Do|Vr|Sa)/i,
|
||||
abbreviated: /^(Son|Maa|Din|Woe|Don|Vry|Sat)/i,
|
||||
wide: /^(Sondag|Maandag|Dinsdag|Woensdag|Donderdag|Vrydag|Saterdag)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^S/i, /^M/i, /^D/i, /^W/i, /^D/i, /^V/i, /^S/i],
|
||||
any: [/^So/i, /^Ma/i, /^Di/i, /^Wo/i, /^Do/i, /^Vr/i, /^Sa/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
any: /^(vm|nm|middernag|(?:uur )?die (oggend|middag|aand))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^vm/i,
|
||||
pm: /^nm/i,
|
||||
midnight: /^middernag/i,
|
||||
noon: /^middaguur/i,
|
||||
morning: /oggend/i,
|
||||
afternoon: /middag/i,
|
||||
evening: /laat middag/i,
|
||||
night: /aand/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./ar-DZ/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar-DZ/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar-DZ/_lib/formatRelative.js";
|
||||
import { localize } from "./ar-DZ/_lib/localize.js";
|
||||
import { match } from "./ar-DZ/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Algerian Arabic).
|
||||
* @language Algerian Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author Badreddine Boumaza [@badre429](https://github.com/badre429)
|
||||
* @author Ahmed ElShahat [@elshahat](https://github.com/elshahat)
|
||||
*/
|
||||
export const arDZ = {
|
||||
code: "ar-DZ",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default arDZ;
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية واحدة",
|
||||
two: "أقل من ثانتين",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية واحدة",
|
||||
two: "ثانتين",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نصف دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقائق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة واحدة",
|
||||
two: "دقيقتين",
|
||||
threeToTen: "{{count}} دقائق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ساعة واحدة تقريباً",
|
||||
two: "ساعتين تقريباً",
|
||||
threeToTen: "{{count}} ساعات تقريباً",
|
||||
other: "{{count}} ساعة تقريباً",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة واحدة",
|
||||
two: "ساعتين",
|
||||
threeToTen: "{{count}} ساعات",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "يوم واحد",
|
||||
two: "يومين",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "أسبوع واحد تقريباً",
|
||||
two: "أسبوعين تقريباً",
|
||||
threeToTen: "{{count}} أسابيع تقريباً",
|
||||
other: "{{count}} أسبوع تقريباً",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "أسبوع واحد",
|
||||
two: "أسبوعين",
|
||||
threeToTen: "{{count}} أسابيع",
|
||||
other: "{{count}} أسبوع",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "شهر واحد تقريباً",
|
||||
two: "شهرين تقريباً",
|
||||
threeToTen: "{{count}} أشهر تقريباً",
|
||||
other: "{{count}} شهر تقريباً",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر واحد",
|
||||
two: "شهرين",
|
||||
threeToTen: "{{count}} أشهر",
|
||||
other: "{{count}} شهر",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "عام واحد",
|
||||
two: "عامين",
|
||||
threeToTen: "{{count}} أعوام",
|
||||
other: "{{count}} عام",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من عام",
|
||||
two: "أكثر من عامين",
|
||||
threeToTen: "أكثر من {{count}} أعوام",
|
||||
other: "أكثر من {{count}} عام",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
options = options || {};
|
||||
|
||||
const usageGroup = formatDistanceLocale[token];
|
||||
let result;
|
||||
if (typeof usageGroup === "string") {
|
||||
result = usageGroup;
|
||||
} else if (count === 1) {
|
||||
result = usageGroup.one;
|
||||
} else if (count === 2) {
|
||||
result = usageGroup.two;
|
||||
} else if (count <= 10) {
|
||||
result = usageGroup.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = usageGroup.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "في خلال " + result;
|
||||
} else {
|
||||
return "منذ " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, MMMM do, y",
|
||||
long: "MMMM do, y",
|
||||
medium: "MMM d, y",
|
||||
short: "MM/dd/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'عند' {{time}}",
|
||||
long: "{{date}} 'عند' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'أخر' eeee 'عند' p",
|
||||
yesterday: "'أمس عند' p",
|
||||
today: "'اليوم عند' p",
|
||||
tomorrow: "'غداً عند' p",
|
||||
nextWeek: "eeee 'عند' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) => {
|
||||
return formatRelativeLocale[token];
|
||||
};
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م.", "ب.م."],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["ج", "ف", "م", "أ", "م", "ج", "ج", "أ", "س", "أ", "ن", "د"],
|
||||
abbreviated: [
|
||||
"جانـ",
|
||||
"فيفـ",
|
||||
"مارس",
|
||||
"أفريل",
|
||||
"مايـ",
|
||||
"جوانـ",
|
||||
"جويـ",
|
||||
"أوت",
|
||||
"سبتـ",
|
||||
"أكتـ",
|
||||
"نوفـ",
|
||||
"ديسـ",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"جانفي",
|
||||
"فيفري",
|
||||
"مارس",
|
||||
"أفريل",
|
||||
"ماي",
|
||||
"جوان",
|
||||
"جويلية",
|
||||
"أوت",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنـ", "ثلا", "أربـ", "خميـ", "جمعة", "سبت"],
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الاثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber) => {
|
||||
return String(dirtyNumber);
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(ق|ب)/i,
|
||||
abbreviated: /^(ق\.?\s?م\.?|ق\.?\s?م\.?\s?|a\.?\s?d\.?|c\.?\s?)/i,
|
||||
wide: /^(قبل الميلاد|قبل الميلاد|بعد الميلاد|بعد الميلاد)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^قبل/i, /^بعد/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^ر[1234]/i,
|
||||
wide: /^الربع [1234]/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[جفمأسند]/i,
|
||||
abbreviated: /^(جان|فيف|مار|أفر|ماي|جوا|جوي|أوت|سبت|أكت|نوف|ديس)/i,
|
||||
wide: /^(جانفي|فيفري|مارس|أفريل|ماي|جوان|جويلية|أوت|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/i,
|
||||
};
|
||||
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ج/i,
|
||||
/^ف/i,
|
||||
/^م/i,
|
||||
/^أ/i,
|
||||
/^م/i,
|
||||
/^ج/i,
|
||||
/^ج/i,
|
||||
/^أ/i,
|
||||
/^س/i,
|
||||
/^أ/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^جان/i,
|
||||
/^فيف/i,
|
||||
/^مار/i,
|
||||
/^أفر/i,
|
||||
/^ماي/i,
|
||||
/^جوا/i,
|
||||
/^جوي/i,
|
||||
/^أوت/i,
|
||||
/^سبت/i,
|
||||
/^أكت/i,
|
||||
/^نوف/i,
|
||||
/^ديس/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[حنثرخجس]/i,
|
||||
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
abbreviated: /^(أحد|اثن|ثلا|أرب|خمي|جمعة|سبت)/i,
|
||||
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
wide: [
|
||||
/^الأحد/i,
|
||||
/^الاثنين/i,
|
||||
/^الثلاثاء/i,
|
||||
/^الأربعاء/i,
|
||||
/^الخميس/i,
|
||||
/^الجمعة/i,
|
||||
/^السبت/i,
|
||||
],
|
||||
|
||||
any: [/^أح/i, /^اث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^mi/i,
|
||||
noon: /^no/i,
|
||||
morning: /morning/i,
|
||||
afternoon: /afternoon/i,
|
||||
evening: /evening/i,
|
||||
night: /night/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => Number(index) + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./ar-EG/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar-EG/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar-EG/_lib/formatRelative.js";
|
||||
import { localize } from "./ar-EG/_lib/localize.js";
|
||||
import { match } from "./ar-EG/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Egypt).
|
||||
* @language Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author AbdAllah AbdElFattah [@AbdAllahAbdElFattah13](https://github.com/AbdAllahAbdElFattah13)
|
||||
*/
|
||||
export const arEG = {
|
||||
code: "ar-EG",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default arEG;
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية",
|
||||
two: "أقل من ثانيتين",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية",
|
||||
two: "ثانيتين",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نص دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقايق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة",
|
||||
two: "دقيقتين",
|
||||
threeToTen: "{{count}} دقايق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "حوالي ساعة",
|
||||
two: "حوالي ساعتين",
|
||||
threeToTen: "حوالي {{count}} ساعات",
|
||||
other: "حوالي {{count}} ساعة",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة",
|
||||
two: "ساعتين",
|
||||
threeToTen: "{{count}} ساعات",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "يوم",
|
||||
two: "يومين",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "حوالي أسبوع",
|
||||
two: "حوالي أسبوعين",
|
||||
threeToTen: "حوالي {{count}} أسابيع",
|
||||
other: "حوالي {{count}} أسبوع",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "أسبوع",
|
||||
two: "أسبوعين",
|
||||
threeToTen: "{{count}} أسابيع",
|
||||
other: "{{count}} أسبوع",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "حوالي شهر",
|
||||
two: "حوالي شهرين",
|
||||
threeToTen: "حوالي {{count}} أشهر",
|
||||
other: "حوالي {{count}} شهر",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر",
|
||||
two: "شهرين",
|
||||
threeToTen: "{{count}} أشهر",
|
||||
other: "{{count}} شهر",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "حوالي سنة",
|
||||
two: "حوالي سنتين",
|
||||
threeToTen: "حوالي {{count}} سنين",
|
||||
other: "حوالي {{count}} سنة",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "عام",
|
||||
two: "عامين",
|
||||
threeToTen: "{{count}} أعوام",
|
||||
other: "{{count}} عام",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من سنة",
|
||||
two: "أكثر من سنتين",
|
||||
threeToTen: "أكثر من {{count}} سنين",
|
||||
other: "أكثر من {{count}} سنة",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "عام تقريبًا",
|
||||
two: "عامين تقريبًا",
|
||||
threeToTen: "{{count}} أعوام تقريبًا",
|
||||
other: "{{count}} عام تقريبًا",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else if (count === 2) {
|
||||
result = tokenValue.two;
|
||||
} else if (count <= 10) {
|
||||
result = tokenValue.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return `في خلال ${result}`;
|
||||
} else {
|
||||
return `منذ ${result}`;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE، do MMMM y",
|
||||
long: "do MMMM y",
|
||||
medium: "dd/MMM/y",
|
||||
short: "d/MM/y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'الساعة' {{time}}",
|
||||
long: "{{date}} 'الساعة' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "eeee 'اللي جاي الساعة' p",
|
||||
yesterday: "'إمبارح الساعة' p",
|
||||
today: "'النهاردة الساعة' p",
|
||||
tomorrow: "'بكرة الساعة' p",
|
||||
nextWeek: "eeee 'الساعة' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م", "ب.م"],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["ي", "ف", "م", "أ", "م", "ي", "ي", "أ", "س", "أ", "ن", "د"],
|
||||
abbreviated: [
|
||||
"ينا",
|
||||
"فبر",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونـ",
|
||||
"يولـ",
|
||||
"أغسـ",
|
||||
"سبتـ",
|
||||
"أكتـ",
|
||||
"نوفـ",
|
||||
"ديسـ",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"يناير",
|
||||
"فبراير",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونيو",
|
||||
"يوليو",
|
||||
"أغسطس",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الاثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهراً",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهراً",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهراً",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
morning: "في الصباح",
|
||||
noon: "ظهراً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, _options) => {
|
||||
return String(dirtyNumber);
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)/;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(ق|ب)/g,
|
||||
abbreviated: /^(ق.م|ب.م)/g,
|
||||
wide: /^(قبل الميلاد|بعد الميلاد)/g,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^ق/g, /^ب/g],
|
||||
};
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/,
|
||||
abbreviated: /^ر[1234]/,
|
||||
wide: /^الربع (الأول|الثاني|الثالث|الرابع)/,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
wide: [/الربع الأول/, /الربع الثاني/, /الربع الثالث/, /الربع الرابع/],
|
||||
|
||||
any: [/1/, /2/, /3/, /4/],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^(ي|ف|م|أ|س|ن|د)/,
|
||||
abbreviated: /^(ينا|فبر|مارس|أبريل|مايو|يونـ|يولـ|أغسـ|سبتـ|أكتـ|نوفـ|ديسـ)/,
|
||||
wide: /^(يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ي/,
|
||||
/^ف/,
|
||||
/^م/,
|
||||
/^أ/,
|
||||
/^م/,
|
||||
/^ي/,
|
||||
/^ي/,
|
||||
/^أ/,
|
||||
/^س/,
|
||||
/^أ/,
|
||||
/^ن/,
|
||||
/^د/,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ينا/,
|
||||
/^فبر/,
|
||||
/^مارس/,
|
||||
/^أبريل/,
|
||||
/^مايو/,
|
||||
/^يون/,
|
||||
/^يول/,
|
||||
/^أغس/,
|
||||
/^سبت/,
|
||||
/^أكت/,
|
||||
/^نوف/,
|
||||
/^ديس/,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(ح|ن|ث|ر|خ|ج|س)/,
|
||||
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/,
|
||||
abbreviated: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/,
|
||||
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/, /^ن/, /^ث/, /^ر/, /^خ/, /^ج/, /^س/],
|
||||
any: [/أحد/, /اثنين/, /ثلاثاء/, /أربعاء/, /خميس/, /جمعة/, /سبت/],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(ص|م|ن|ظ|في الصباح|بعد الظهر|في المساء|في الليل)/,
|
||||
abbreviated: /^(ص|م|نصف الليل|ظهراً|في الصباح|بعد الظهر|في المساء|في الليل)/,
|
||||
wide: /^(ص|م|نصف الليل|في الصباح|ظهراً|بعد الظهر|في المساء|في الليل)/,
|
||||
any: /^(ص|م|صباح|ظهر|مساء|ليل)/,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^ص/,
|
||||
pm: /^م/,
|
||||
midnight: /^ن/,
|
||||
noon: /^ظ/,
|
||||
morning: /^ص/,
|
||||
afternoon: /^بعد/,
|
||||
evening: /^م/,
|
||||
night: /^ل/,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: function (value) {
|
||||
return parseInt(value, 10);
|
||||
},
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./ar-MA/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar-MA/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar-MA/_lib/formatRelative.js";
|
||||
import { localize } from "./ar-MA/_lib/localize.js";
|
||||
import { match } from "./ar-MA/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Moroccan Arabic).
|
||||
* @language Moroccan Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author Achraf Rrami [@rramiachraf](https://github.com/rramiachraf)
|
||||
*/
|
||||
export const arMA = {
|
||||
code: "ar-MA",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
// Monday is 1
|
||||
weekStartsOn: 1,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default arMA;
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية واحدة",
|
||||
two: "أقل من ثانتين",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية واحدة",
|
||||
two: "ثانتين",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نصف دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقائق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة واحدة",
|
||||
two: "دقيقتين",
|
||||
threeToTen: "{{count}} دقائق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ساعة واحدة تقريباً",
|
||||
two: "ساعتين تقريباً",
|
||||
threeToTen: "{{count}} ساعات تقريباً",
|
||||
other: "{{count}} ساعة تقريباً",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة واحدة",
|
||||
two: "ساعتين",
|
||||
threeToTen: "{{count}} ساعات",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "يوم واحد",
|
||||
two: "يومين",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "أسبوع واحد تقريباً",
|
||||
two: "أسبوعين تقريباً",
|
||||
threeToTen: "{{count}} أسابيع تقريباً",
|
||||
other: "{{count}} أسبوع تقريباً",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "أسبوع واحد",
|
||||
two: "أسبوعين",
|
||||
threeToTen: "{{count}} أسابيع",
|
||||
other: "{{count}} أسبوع",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "شهر واحد تقريباً",
|
||||
two: "شهرين تقريباً",
|
||||
threeToTen: "{{count}} أشهر تقريباً",
|
||||
other: "{{count}} شهر تقريباً",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر واحد",
|
||||
two: "شهرين",
|
||||
threeToTen: "{{count}} أشهر",
|
||||
other: "{{count}} شهر",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "عام واحد",
|
||||
two: "عامين",
|
||||
threeToTen: "{{count}} أعوام",
|
||||
other: "{{count}} عام",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من عام",
|
||||
two: "أكثر من عامين",
|
||||
threeToTen: "أكثر من {{count}} أعوام",
|
||||
other: "أكثر من {{count}} عام",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
options = options || {};
|
||||
|
||||
const usageGroup = formatDistanceLocale[token];
|
||||
let result;
|
||||
if (typeof usageGroup === "string") {
|
||||
result = usageGroup;
|
||||
} else if (count === 1) {
|
||||
result = usageGroup.one;
|
||||
} else if (count === 2) {
|
||||
result = usageGroup.two;
|
||||
} else if (count <= 10) {
|
||||
result = usageGroup.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = usageGroup.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "في خلال " + result;
|
||||
} else {
|
||||
return "منذ " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, MMMM do, y",
|
||||
long: "MMMM do, y",
|
||||
medium: "MMM d, y",
|
||||
short: "MM/dd/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'عند' {{time}}",
|
||||
long: "{{date}} 'عند' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'أخر' eeee 'عند' p",
|
||||
yesterday: "'أمس عند' p",
|
||||
today: "'اليوم عند' p",
|
||||
tomorrow: "'غداً عند' p",
|
||||
nextWeek: "eeee 'عند' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) => {
|
||||
return formatRelativeLocale[token];
|
||||
};
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م.", "ب.م."],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["ي", "ف", "م", "أ", "م", "ي", "ي", "غ", "ش", "أ", "ن", "د"],
|
||||
abbreviated: [
|
||||
"ينا",
|
||||
"فبر",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"ماي",
|
||||
"يونـ",
|
||||
"يولـ",
|
||||
"غشت",
|
||||
"شتنـ",
|
||||
"أكتـ",
|
||||
"نونـ",
|
||||
"دجنـ",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"يناير",
|
||||
"فبراير",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"ماي",
|
||||
"يونيو",
|
||||
"يوليوز",
|
||||
"غشت",
|
||||
"شتنبر",
|
||||
"أكتوبر",
|
||||
"نونبر",
|
||||
"دجنبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنـ", "ثلا", "أربـ", "خميـ", "جمعة", "سبت"],
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الإثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber) => {
|
||||
return String(dirtyNumber);
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(ق|ب)/i,
|
||||
abbreviated: /^(ق\.?\s?م\.?|ق\.?\s?م\.?\s?|a\.?\s?d\.?|c\.?\s?)/i,
|
||||
wide: /^(قبل الميلاد|قبل الميلاد|بعد الميلاد|بعد الميلاد)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^قبل/i, /^بعد/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^ر[1234]/i,
|
||||
wide: /^الربع [1234]/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[يفمأمسند]/i,
|
||||
abbreviated: /^(ين|ف|مار|أب|ماي|يون|يول|غش|شت|أك|ن|د)/i,
|
||||
wide: /^(ين|ف|مار|أب|ماي|يون|يول|غش|شت|أك|ن|د)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ي/i,
|
||||
/^ف/i,
|
||||
/^م/i,
|
||||
/^أ/i,
|
||||
/^م/i,
|
||||
/^ي/i,
|
||||
/^ي/i,
|
||||
/^غ/i,
|
||||
/^ش/i,
|
||||
/^أ/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ين/i,
|
||||
/^فب/i,
|
||||
/^مار/i,
|
||||
/^أب/i,
|
||||
/^ماي/i,
|
||||
/^يون/i,
|
||||
/^يول/i,
|
||||
/^غشت/i,
|
||||
/^ش/i,
|
||||
/^أك/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[حنثرخجس]/i,
|
||||
short: /^(أحد|إثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
abbreviated: /^(أحد|إثن|ثلا|أرب|خمي|جمعة|سبت)/i,
|
||||
wide: /^(الأحد|الإثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
wide: [
|
||||
/^الأحد/i,
|
||||
/^الإثنين/i,
|
||||
/^الثلاثاء/i,
|
||||
/^الأربعاء/i,
|
||||
/^الخميس/i,
|
||||
/^الجمعة/i,
|
||||
/^السبت/i,
|
||||
],
|
||||
|
||||
any: [/^أح/i, /^إث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^mi/i,
|
||||
noon: /^no/i,
|
||||
morning: /morning/i,
|
||||
afternoon: /afternoon/i,
|
||||
evening: /evening/i,
|
||||
night: /night/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => Number(index) + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./ar-SA/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar-SA/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar-SA/_lib/formatRelative.js";
|
||||
import { localize } from "./ar-SA/_lib/localize.js";
|
||||
import { match } from "./ar-SA/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Sauid Arabic).
|
||||
* @language Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author Dhaifallah Alwadani [@dalwadani](https://github.com/dalwadani)
|
||||
*/
|
||||
export const arSA = {
|
||||
code: "ar-SA",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default arSA;
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية واحدة",
|
||||
two: "أقل من ثانتين",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية واحدة",
|
||||
two: "ثانتين",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نصف دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقائق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة واحدة",
|
||||
two: "دقيقتين",
|
||||
threeToTen: "{{count}} دقائق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ساعة واحدة تقريباً",
|
||||
two: "ساعتين تقريباً",
|
||||
threeToTen: "{{count}} ساعات تقريباً",
|
||||
other: "{{count}} ساعة تقريباً",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة واحدة",
|
||||
two: "ساعتين",
|
||||
threeToTen: "{{count}} ساعات",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "يوم واحد",
|
||||
two: "يومين",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "أسبوع واحد تقريباً",
|
||||
two: "أسبوعين تقريباً",
|
||||
threeToTen: "{{count}} أسابيع تقريباً",
|
||||
other: "{{count}} أسبوع تقريباً",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "أسبوع واحد",
|
||||
two: "أسبوعين",
|
||||
threeToTen: "{{count}} أسابيع",
|
||||
other: "{{count}} أسبوع",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "شهر واحد تقريباً",
|
||||
two: "شهرين تقريباً",
|
||||
threeToTen: "{{count}} أشهر تقريباً",
|
||||
other: "{{count}} شهر تقريباً",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر واحد",
|
||||
two: "شهرين",
|
||||
threeToTen: "{{count}} أشهر",
|
||||
other: "{{count}} شهر",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "عام واحد",
|
||||
two: "عامين",
|
||||
threeToTen: "{{count}} أعوام",
|
||||
other: "{{count}} عام",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من عام",
|
||||
two: "أكثر من عامين",
|
||||
threeToTen: "أكثر من {{count}} أعوام",
|
||||
other: "أكثر من {{count}} عام",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "عام واحد تقريباً",
|
||||
two: "عامين تقريباً",
|
||||
threeToTen: "{{count}} أعوام تقريباً",
|
||||
other: "{{count}} عام تقريباً",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else if (count === 2) {
|
||||
result = tokenValue.two;
|
||||
} else if (count <= 10) {
|
||||
result = tokenValue.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "في خلال " + result;
|
||||
} else {
|
||||
return "منذ " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, MMMM do, y",
|
||||
long: "MMMM do, y",
|
||||
medium: "MMM d, y",
|
||||
short: "MM/dd/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'عند' {{time}}",
|
||||
long: "{{date}} 'عند' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'أخر' eeee 'عند' p",
|
||||
yesterday: "'أمس عند' p",
|
||||
today: "'اليوم عند' p",
|
||||
tomorrow: "'غداً عند' p",
|
||||
nextWeek: "eeee 'عند' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م.", "ب.م."],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["ي", "ف", "م", "أ", "م", "ي", "ي", "أ", "س", "أ", "ن", "د"],
|
||||
abbreviated: [
|
||||
"ينا",
|
||||
"فبر",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونـ",
|
||||
"يولـ",
|
||||
"أغسـ",
|
||||
"سبتـ",
|
||||
"أكتـ",
|
||||
"نوفـ",
|
||||
"ديسـ",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"يناير",
|
||||
"فبراير",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونيو",
|
||||
"يوليو",
|
||||
"أغسطس",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنـ", "ثلا", "أربـ", "خميـ", "جمعة", "سبت"],
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الاثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "مساءاً",
|
||||
night: "ليلاً",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "ن",
|
||||
noon: "ظ",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "في الصباح",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
midnight: "نصف الليل",
|
||||
noon: "ظهر",
|
||||
morning: "صباحاً",
|
||||
afternoon: "بعد الظـهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber) => {
|
||||
return String(dirtyNumber);
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(ق|ب)/i,
|
||||
abbreviated: /^(ق\.?\s?م\.?|ق\.?\s?م\.?\s?|a\.?\s?d\.?|c\.?\s?)/i,
|
||||
wide: /^(قبل الميلاد|قبل الميلاد|بعد الميلاد|بعد الميلاد)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^قبل/i, /^بعد/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^ر[1234]/i,
|
||||
wide: /^الربع [1234]/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[يفمأمسند]/i,
|
||||
abbreviated: /^(ين|ف|مار|أب|ماي|يون|يول|أغ|س|أك|ن|د)/i,
|
||||
wide: /^(ين|ف|مار|أب|ماي|يون|يول|أغ|س|أك|ن|د)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ي/i,
|
||||
/^ف/i,
|
||||
/^م/i,
|
||||
/^أ/i,
|
||||
/^م/i,
|
||||
/^ي/i,
|
||||
/^ي/i,
|
||||
/^أ/i,
|
||||
/^س/i,
|
||||
/^أ/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ين/i,
|
||||
/^ف/i,
|
||||
/^مار/i,
|
||||
/^أب/i,
|
||||
/^ماي/i,
|
||||
/^يون/i,
|
||||
/^يول/i,
|
||||
/^أغ/i,
|
||||
/^س/i,
|
||||
/^أك/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[حنثرخجس]/i,
|
||||
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
abbreviated: /^(أحد|اثن|ثلا|أرب|خمي|جمعة|سبت)/i,
|
||||
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
wide: [
|
||||
/^الأحد/i,
|
||||
/^الاثنين/i,
|
||||
/^الثلاثاء/i,
|
||||
/^الأربعاء/i,
|
||||
/^الخميس/i,
|
||||
/^الجمعة/i,
|
||||
/^السبت/i,
|
||||
],
|
||||
|
||||
any: [/^أح/i, /^اث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^mi/i,
|
||||
noon: /^no/i,
|
||||
morning: /morning/i,
|
||||
afternoon: /afternoon/i,
|
||||
evening: /evening/i,
|
||||
night: /night/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./ar-TN/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar-TN/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar-TN/_lib/formatRelative.js";
|
||||
import { localize } from "./ar-TN/_lib/localize.js";
|
||||
import { match } from "./ar-TN/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Tunisian Arabic).
|
||||
* @language Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author Koussay Haj Kacem [@essana3](https://github.com/essana3)
|
||||
*/
|
||||
export const arTN = {
|
||||
code: "ar-TN",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default arTN;
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية",
|
||||
two: "أقل من زوز ثواني",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية",
|
||||
two: "زوز ثواني",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نص دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقايق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة",
|
||||
two: "دقيقتين",
|
||||
threeToTen: "{{count}} دقايق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ساعة تقريب",
|
||||
two: "ساعتين تقريب",
|
||||
threeToTen: "{{count}} سوايع تقريب",
|
||||
other: "{{count}} ساعة تقريب",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة",
|
||||
two: "ساعتين",
|
||||
threeToTen: "{{count}} سوايع",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "نهار",
|
||||
two: "نهارين",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "جمعة تقريب",
|
||||
two: "جمعتين تقريب",
|
||||
threeToTen: "{{count}} جماع تقريب",
|
||||
other: "{{count}} جمعة تقريب",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "جمعة",
|
||||
two: "جمعتين",
|
||||
threeToTen: "{{count}} جماع",
|
||||
other: "{{count}} جمعة",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "شهر تقريب",
|
||||
two: "شهرين تقريب",
|
||||
threeToTen: "{{count}} أشهرة تقريب",
|
||||
other: "{{count}} شهر تقريب",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر",
|
||||
two: "شهرين",
|
||||
threeToTen: "{{count}} أشهرة",
|
||||
other: "{{count}} شهر",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "عام تقريب",
|
||||
two: "عامين تقريب",
|
||||
threeToTen: "{{count}} أعوام تقريب",
|
||||
other: "{{count}} عام تقريب",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "عام",
|
||||
two: "عامين",
|
||||
threeToTen: "{{count}} أعوام",
|
||||
other: "{{count}} عام",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من عام",
|
||||
two: "أكثر من عامين",
|
||||
threeToTen: "أكثر من {{count}} أعوام",
|
||||
other: "أكثر من {{count}} عام",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "عام تقريب",
|
||||
two: "عامين تقريب",
|
||||
threeToTen: "{{count}} أعوام تقريب",
|
||||
other: "{{count}} عام تقريب",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
const usageGroup = formatDistanceLocale[token];
|
||||
let result;
|
||||
if (typeof usageGroup === "string") {
|
||||
result = usageGroup;
|
||||
} else if (count === 1) {
|
||||
result = usageGroup.one;
|
||||
} else if (count === 2) {
|
||||
result = usageGroup.two;
|
||||
} else if (count <= 10) {
|
||||
result = usageGroup.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = usageGroup.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "في " + result;
|
||||
} else {
|
||||
return "عندو " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE، do MMMM y",
|
||||
long: "do MMMM y",
|
||||
medium: "d MMM y",
|
||||
short: "dd/MM/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss",
|
||||
long: "HH:mm:ss",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'مع' {{time}}",
|
||||
long: "{{date}} 'مع' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "eeee 'إلي فات مع' p",
|
||||
yesterday: "'البارح مع' p",
|
||||
today: "'اليوم مع' p",
|
||||
tomorrow: "'غدوة مع' p",
|
||||
nextWeek: "eeee 'الجمعة الجاية مع' p 'نهار'",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token) => formatRelativeLocale[token];
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م.", "ب.م."],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["د", "ن", "أ", "س", "أ", "ج", "ج", "م", "أ", "م", "ف", "ج"],
|
||||
abbreviated: [
|
||||
"جانفي",
|
||||
"فيفري",
|
||||
"مارس",
|
||||
"أفريل",
|
||||
"ماي",
|
||||
"جوان",
|
||||
"جويلية",
|
||||
"أوت",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"جانفي",
|
||||
"فيفري",
|
||||
"مارس",
|
||||
"أفريل",
|
||||
"ماي",
|
||||
"جوان",
|
||||
"جويلية",
|
||||
"أوت",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الاثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "الصباح",
|
||||
noon: "القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "العشية",
|
||||
night: "الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "الصباح",
|
||||
noon: "القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "العشية",
|
||||
night: "الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "الصباح",
|
||||
noon: "القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "العشية",
|
||||
night: "الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "في الصباح",
|
||||
noon: "في القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "في العشية",
|
||||
night: "في الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "في الصباح",
|
||||
noon: "في القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "في العشية",
|
||||
night: "في الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "ع",
|
||||
morning: "في الصباح",
|
||||
noon: "في القايلة",
|
||||
afternoon: "بعد القايلة",
|
||||
evening: "في العشية",
|
||||
night: "في الليل",
|
||||
midnight: "نص الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (num) => String(num);
|
||||
|
||||
export const localize = {
|
||||
ordinalNumber: 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",
|
||||
}),
|
||||
};
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /[قب]/,
|
||||
abbreviated: /[قب]\.م\./,
|
||||
wide: /(قبل|بعد) الميلاد/,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/قبل/, /بعد/],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /ر[1234]/,
|
||||
wide: /الربع (الأول|الثاني|الثالث|الرابع)/,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[جفمأسند]/,
|
||||
abbreviated:
|
||||
/^(جانفي|فيفري|مارس|أفريل|ماي|جوان|جويلية|أوت|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
|
||||
wide: /^(جانفي|فيفري|مارس|أفريل|ماي|جوان|جويلية|أوت|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ج/i,
|
||||
/^ف/i,
|
||||
/^م/i,
|
||||
/^أ/i,
|
||||
/^م/i,
|
||||
/^ج/i,
|
||||
/^ج/i,
|
||||
/^أ/i,
|
||||
/^س/i,
|
||||
/^أ/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^جانفي/i,
|
||||
/^فيفري/i,
|
||||
/^مارس/i,
|
||||
/^أفريل/i,
|
||||
/^ماي/i,
|
||||
/^جوان/i,
|
||||
/^جويلية/i,
|
||||
/^أوت/i,
|
||||
/^سبتمبر/i,
|
||||
/^أكتوبر/i,
|
||||
/^نوفمبر/i,
|
||||
/^ديسمبر/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[حنثرخجس]/i,
|
||||
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
abbreviated: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
wide: [
|
||||
/^الأحد/i,
|
||||
/^الاثنين/i,
|
||||
/^الثلاثاء/i,
|
||||
/^الأربعاء/i,
|
||||
/^الخميس/i,
|
||||
/^الجمعة/i,
|
||||
/^السبت/i,
|
||||
],
|
||||
|
||||
any: [/^أح/i, /^اث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(ص|ع|ن ل|ل|(في|مع) (صباح|قايلة|عشية|ليل))/,
|
||||
any: /^([صع]|نص الليل|قايلة|(في|مع) (صباح|قايلة|عشية|ليل))/,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^ص/,
|
||||
pm: /^ع/,
|
||||
midnight: /نص الليل/,
|
||||
noon: /قايلة/,
|
||||
afternoon: /بعد القايلة/,
|
||||
morning: /صباح/,
|
||||
evening: /عشية/,
|
||||
night: /ليل/,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./ar/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ar/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ar/_lib/formatRelative.js";
|
||||
import { localize } from "./ar/_lib/localize.js";
|
||||
import { match } from "./ar/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Arabic locale (Modern Standard Arabic - Al-fussha).
|
||||
* @language Modern Standard Arabic
|
||||
* @iso-639-2 ara
|
||||
* @author Abdallah Hassan [@AbdallahAHO](https://github.com/AbdallahAHO)
|
||||
* @author Koussay Haj Kacem [@essana3](https://github.com/essana3)
|
||||
*/
|
||||
export const ar = {
|
||||
code: "ar",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 6 /* Saturday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default ar;
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "أقل من ثانية",
|
||||
two: "أقل من ثانيتين",
|
||||
threeToTen: "أقل من {{count}} ثواني",
|
||||
other: "أقل من {{count}} ثانية",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "ثانية واحدة",
|
||||
two: "ثانيتان",
|
||||
threeToTen: "{{count}} ثواني",
|
||||
other: "{{count}} ثانية",
|
||||
},
|
||||
|
||||
halfAMinute: "نصف دقيقة",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "أقل من دقيقة",
|
||||
two: "أقل من دقيقتين",
|
||||
threeToTen: "أقل من {{count}} دقائق",
|
||||
other: "أقل من {{count}} دقيقة",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "دقيقة واحدة",
|
||||
two: "دقيقتان",
|
||||
threeToTen: "{{count}} دقائق",
|
||||
other: "{{count}} دقيقة",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "ساعة واحدة تقريباً",
|
||||
two: "ساعتين تقريبا",
|
||||
threeToTen: "{{count}} ساعات تقريباً",
|
||||
other: "{{count}} ساعة تقريباً",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "ساعة واحدة",
|
||||
two: "ساعتان",
|
||||
threeToTen: "{{count}} ساعات",
|
||||
other: "{{count}} ساعة",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "يوم واحد",
|
||||
two: "يومان",
|
||||
threeToTen: "{{count}} أيام",
|
||||
other: "{{count}} يوم",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "أسبوع واحد تقريبا",
|
||||
two: "أسبوعين تقريبا",
|
||||
threeToTen: "{{count}} أسابيع تقريبا",
|
||||
other: "{{count}} أسبوعا تقريبا",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "أسبوع واحد",
|
||||
two: "أسبوعان",
|
||||
threeToTen: "{{count}} أسابيع",
|
||||
other: "{{count}} أسبوعا",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "شهر واحد تقريباً",
|
||||
two: "شهرين تقريبا",
|
||||
threeToTen: "{{count}} أشهر تقريبا",
|
||||
other: "{{count}} شهرا تقريباً",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "شهر واحد",
|
||||
two: "شهران",
|
||||
threeToTen: "{{count}} أشهر",
|
||||
other: "{{count}} شهرا",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "سنة واحدة تقريباً",
|
||||
two: "سنتين تقريبا",
|
||||
threeToTen: "{{count}} سنوات تقريباً",
|
||||
other: "{{count}} سنة تقريباً",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "سنة واحد",
|
||||
two: "سنتان",
|
||||
threeToTen: "{{count}} سنوات",
|
||||
other: "{{count}} سنة",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "أكثر من سنة",
|
||||
two: "أكثر من سنتين",
|
||||
threeToTen: "أكثر من {{count}} سنوات",
|
||||
other: "أكثر من {{count}} سنة",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "ما يقارب سنة واحدة",
|
||||
two: "ما يقارب سنتين",
|
||||
threeToTen: "ما يقارب {{count}} سنوات",
|
||||
other: "ما يقارب {{count}} سنة",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
const usageGroup = formatDistanceLocale[token];
|
||||
let result;
|
||||
if (typeof usageGroup === "string") {
|
||||
result = usageGroup;
|
||||
} else if (count === 1) {
|
||||
result = usageGroup.one;
|
||||
} else if (count === 2) {
|
||||
result = usageGroup.two;
|
||||
} else if (count <= 10) {
|
||||
result = usageGroup.threeToTen.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = usageGroup.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "خلال " + result;
|
||||
} else {
|
||||
return "منذ " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE، do MMMM y",
|
||||
long: "do MMMM y",
|
||||
medium: "d MMM y",
|
||||
short: "dd/MM/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss",
|
||||
long: "HH:mm:ss",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'عند الساعة' {{time}}",
|
||||
long: "{{date}} 'عند الساعة' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "eeee 'الماضي عند الساعة' p",
|
||||
yesterday: "'الأمس عند الساعة' p",
|
||||
today: "'اليوم عند الساعة' p",
|
||||
tomorrow: "'غدا عند الساعة' p",
|
||||
nextWeek: "eeee 'القادم عند الساعة' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token) => formatRelativeLocale[token];
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["ق", "ب"],
|
||||
abbreviated: ["ق.م.", "ب.م."],
|
||||
wide: ["قبل الميلاد", "بعد الميلاد"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["ر1", "ر2", "ر3", "ر4"],
|
||||
wide: ["الربع الأول", "الربع الثاني", "الربع الثالث", "الربع الرابع"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["ي", "ف", "م", "أ", "م", "ي", "ي", "أ", "س", "أ", "ن", "د"],
|
||||
abbreviated: [
|
||||
"يناير",
|
||||
"فبراير",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونيو",
|
||||
"يوليو",
|
||||
"أغسطس",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"يناير",
|
||||
"فبراير",
|
||||
"مارس",
|
||||
"أبريل",
|
||||
"مايو",
|
||||
"يونيو",
|
||||
"يوليو",
|
||||
"أغسطس",
|
||||
"سبتمبر",
|
||||
"أكتوبر",
|
||||
"نوفمبر",
|
||||
"ديسمبر",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ح", "ن", "ث", "ر", "خ", "ج", "س"],
|
||||
short: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
abbreviated: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
||||
|
||||
wide: [
|
||||
"الأحد",
|
||||
"الاثنين",
|
||||
"الثلاثاء",
|
||||
"الأربعاء",
|
||||
"الخميس",
|
||||
"الجمعة",
|
||||
"السبت",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "المساء",
|
||||
night: "الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "المساء",
|
||||
night: "الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "المساء",
|
||||
night: "الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "في الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "في الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
wide: {
|
||||
am: "ص",
|
||||
pm: "م",
|
||||
morning: "في الصباح",
|
||||
noon: "الظهر",
|
||||
afternoon: "بعد الظهر",
|
||||
evening: "في المساء",
|
||||
night: "في الليل",
|
||||
midnight: "منتصف الليل",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (num) => String(num);
|
||||
|
||||
export const localize = {
|
||||
ordinalNumber: 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",
|
||||
}),
|
||||
};
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /[قب]/,
|
||||
abbreviated: /[قب]\.م\./,
|
||||
wide: /(قبل|بعد) الميلاد/,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/قبل/, /بعد/],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /ر[1234]/,
|
||||
wide: /الربع (الأول|الثاني|الثالث|الرابع)/,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[أيفمسند]/,
|
||||
abbreviated:
|
||||
/^(يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
|
||||
wide: /^(يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ي/i,
|
||||
/^ف/i,
|
||||
/^م/i,
|
||||
/^أ/i,
|
||||
/^م/i,
|
||||
/^ي/i,
|
||||
/^ي/i,
|
||||
/^أ/i,
|
||||
/^س/i,
|
||||
/^أ/i,
|
||||
/^ن/i,
|
||||
/^د/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^يناير/i,
|
||||
/^فبراير/i,
|
||||
/^مارس/i,
|
||||
/^أبريل/i,
|
||||
/^مايو/i,
|
||||
/^يونيو/i,
|
||||
/^يوليو/i,
|
||||
/^أغسطس/i,
|
||||
/^سبتمبر/i,
|
||||
/^أكتوبر/i,
|
||||
/^نوفمبر/i,
|
||||
/^ديسمبر/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[حنثرخجس]/i,
|
||||
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
abbreviated: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
|
||||
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
wide: [
|
||||
/^الأحد/i,
|
||||
/^الاثنين/i,
|
||||
/^الثلاثاء/i,
|
||||
/^الأربعاء/i,
|
||||
/^الخميس/i,
|
||||
/^الجمعة/i,
|
||||
/^السبت/i,
|
||||
],
|
||||
|
||||
any: [/^أح/i, /^اث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(ص|م|منتصف الليل|الظهر|بعد الظهر|في الصباح|في المساء|في الليل)/,
|
||||
any: /^(ص|م|منتصف الليل|الظهر|بعد الظهر|في الصباح|في المساء|في الليل)/,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^ص/,
|
||||
pm: /^م/,
|
||||
midnight: /منتصف الليل/,
|
||||
noon: /الظهر/,
|
||||
afternoon: /بعد الظهر/,
|
||||
morning: /في الصباح/,
|
||||
evening: /في المساء/,
|
||||
night: /في الليل/,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./az/_lib/formatDistance.js";
|
||||
import { formatLong } from "./az/_lib/formatLong.js";
|
||||
import { formatRelative } from "./az/_lib/formatRelative.js";
|
||||
import { localize } from "./az/_lib/localize.js";
|
||||
import { match } from "./az/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Azerbaijani locale.
|
||||
* @language Azerbaijani
|
||||
* @iso-639-2 aze
|
||||
*/
|
||||
|
||||
export const az = {
|
||||
code: "az",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default az;
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "bir saniyədən az",
|
||||
other: "{{count}} bir saniyədən az",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 saniyə",
|
||||
other: "{{count}} saniyə",
|
||||
},
|
||||
|
||||
halfAMinute: "yarım dəqiqə",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "bir dəqiqədən az",
|
||||
other: "{{count}} bir dəqiqədən az",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "bir dəqiqə",
|
||||
other: "{{count}} dəqiqə",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "təxminən 1 saat",
|
||||
other: "təxminən {{count}} saat",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 saat",
|
||||
other: "{{count}} saat",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 gün",
|
||||
other: "{{count}} gün",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "təxminən 1 həftə",
|
||||
other: "təxminən {{count}} həftə",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 həftə",
|
||||
other: "{{count}} həftə",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "təxminən 1 ay",
|
||||
other: "təxminən {{count}} ay",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 ay",
|
||||
other: "{{count}} ay",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "təxminən 1 il",
|
||||
other: "təxminən {{count}} il",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 il",
|
||||
other: "{{count}} il",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "1 ildən çox",
|
||||
other: "{{count}} ildən çox",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "demək olar ki 1 il",
|
||||
other: "demək olar ki {{count}} il",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return result + " sonra";
|
||||
} else {
|
||||
return result + " əvvəl";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, do MMMM y 'il'",
|
||||
long: "do MMMM y 'il'",
|
||||
medium: "d MMM y 'il'",
|
||||
short: "dd.MM.yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "H:mm:ss zzzz",
|
||||
long: "H:mm:ss z",
|
||||
medium: "H:mm:ss",
|
||||
short: "H:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} {{time}} - 'də'",
|
||||
long: "{{date}} {{time}} - 'də'",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'sonuncu' eeee p -'də'",
|
||||
yesterday: "'dünən' p -'də'",
|
||||
today: "'bugün' p -'də'",
|
||||
tomorrow: "'sabah' p -'də'",
|
||||
nextWeek: "eeee p -'də'",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["e.ə", "b.e"],
|
||||
abbreviated: ["e.ə", "b.e"],
|
||||
wide: ["eramızdan əvvəl", "bizim era"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["K1", "K2", "K3", "K4"],
|
||||
wide: ["1ci kvartal", "2ci kvartal", "3cü kvartal", "4cü kvartal"],
|
||||
};
|
||||
const monthValues = {
|
||||
narrow: ["Y", "F", "M", "A", "M", "İ", "İ", "A", "S", "O", "N", "D"],
|
||||
abbreviated: [
|
||||
"Yan",
|
||||
"Fev",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"İyun",
|
||||
"İyul",
|
||||
"Avq",
|
||||
"Sen",
|
||||
"Okt",
|
||||
"Noy",
|
||||
"Dek",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"Yanvar",
|
||||
"Fevral",
|
||||
"Mart",
|
||||
"Aprel",
|
||||
"May",
|
||||
"İyun",
|
||||
"İyul",
|
||||
"Avqust",
|
||||
"Sentyabr",
|
||||
"Oktyabr",
|
||||
"Noyabr",
|
||||
"Dekabr",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["B.", "B.e", "Ç.a", "Ç.", "C.a", "C.", "Ş."],
|
||||
short: ["B.", "B.e", "Ç.a", "Ç.", "C.a", "C.", "Ş."],
|
||||
abbreviated: ["Baz", "Baz.e", "Çər.a", "Çər", "Cüm.a", "Cüm", "Şə"],
|
||||
wide: [
|
||||
"Bazar",
|
||||
"Bazar ertəsi",
|
||||
"Çərşənbə axşamı",
|
||||
"Çərşənbə",
|
||||
"Cümə axşamı",
|
||||
"Cümə",
|
||||
"Şənbə",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
wide: {
|
||||
am: "a.m.",
|
||||
pm: "p.m.",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "a",
|
||||
pm: "p",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
wide: {
|
||||
am: "a.m.",
|
||||
pm: "p.m.",
|
||||
midnight: "gecəyarı",
|
||||
noon: "gün",
|
||||
morning: "səhər",
|
||||
afternoon: "gündüz",
|
||||
evening: "axşam",
|
||||
night: "gecə",
|
||||
},
|
||||
};
|
||||
|
||||
const suffixes = {
|
||||
1: "-inci",
|
||||
5: "-inci",
|
||||
8: "-inci",
|
||||
70: "-inci",
|
||||
80: "-inci",
|
||||
2: "-nci",
|
||||
7: "-nci",
|
||||
20: "-nci",
|
||||
50: "-nci",
|
||||
3: "-üncü",
|
||||
4: "-üncü",
|
||||
100: "-üncü",
|
||||
6: "-ncı",
|
||||
9: "-uncu",
|
||||
10: "-uncu",
|
||||
30: "-uncu",
|
||||
60: "-ıncı",
|
||||
90: "-ıncı",
|
||||
};
|
||||
|
||||
const getSuffix = (number) => {
|
||||
if (number === 0) {
|
||||
// special case for zero
|
||||
return number + "-ıncı";
|
||||
}
|
||||
|
||||
const a = number % 10;
|
||||
const b = (number % 100) - a;
|
||||
const c = number >= 100 ? 100 : null;
|
||||
|
||||
if (suffixes[a]) {
|
||||
return suffixes[a];
|
||||
} else if (suffixes[b]) {
|
||||
return suffixes[b];
|
||||
} else if (c !== null) {
|
||||
return suffixes[c];
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, _options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const suffix = getSuffix(number);
|
||||
|
||||
return number + suffix;
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(-?(ci|inci|nci|uncu|üncü|ncı))?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(b|a)$/i,
|
||||
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)$/i,
|
||||
wide: /^(bizim eradan əvvəl|bizim era)$/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^b$/i, /^(a|c)$/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]$/i,
|
||||
abbreviated: /^K[1234]$/i,
|
||||
wide: /^[1234](ci)? kvartal$/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[(?-i)yfmaisond]$/i,
|
||||
abbreviated: /^(Yan|Fev|Mar|Apr|May|İyun|İyul|Avq|Sen|Okt|Noy|Dek)$/i,
|
||||
wide: /^(Yanvar|Fevral|Mart|Aprel|May|İyun|İyul|Avgust|Sentyabr|Oktyabr|Noyabr|Dekabr)$/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^[(?-i)y]$/i,
|
||||
/^[(?-i)f]$/i,
|
||||
/^[(?-i)m]$/i,
|
||||
/^[(?-i)a]$/i,
|
||||
/^[(?-i)m]$/i,
|
||||
/^[(?-i)i]$/i,
|
||||
/^[(?-i)i]$/i,
|
||||
/^[(?-i)a]$/i,
|
||||
/^[(?-i)s]$/i,
|
||||
/^[(?-i)o]$/i,
|
||||
/^[(?-i)n]$/i,
|
||||
/^[(?-i)d]$/i,
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
/^Yan$/i,
|
||||
/^Fev$/i,
|
||||
/^Mar$/i,
|
||||
/^Apr$/i,
|
||||
/^May$/i,
|
||||
/^İyun$/i,
|
||||
/^İyul$/i,
|
||||
/^Avg$/i,
|
||||
/^Sen$/i,
|
||||
/^Okt$/i,
|
||||
/^Noy$/i,
|
||||
/^Dek$/i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^Yanvar$/i,
|
||||
/^Fevral$/i,
|
||||
/^Mart$/i,
|
||||
/^Aprel$/i,
|
||||
/^May$/i,
|
||||
/^İyun$/i,
|
||||
/^İyul$/i,
|
||||
/^Avgust$/i,
|
||||
/^Sentyabr$/i,
|
||||
/^Oktyabr$/i,
|
||||
/^Noyabr$/i,
|
||||
/^Dekabr$/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(B\.|B\.e|Ç\.a|Ç\.|C\.a|C\.|Ş\.)$/i,
|
||||
short: /^(B\.|B\.e|Ç\.a|Ç\.|C\.a|C\.|Ş\.)$/i,
|
||||
abbreviated: /^(Baz\.e|Çər|Çər\.a|Cüm|Cüm\.a|Şə)$/i,
|
||||
wide: /^(Bazar|Bazar ertəsi|Çərşənbə axşamı|Çərşənbə|Cümə axşamı|Cümə|Şənbə)$/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [
|
||||
/^B\.$/i,
|
||||
/^B\.e$/i,
|
||||
/^Ç\.a$/i,
|
||||
/^Ç\.$/i,
|
||||
/^C\.a$/i,
|
||||
/^C\.$/i,
|
||||
/^Ş\.$/i,
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
/^Baz$/i,
|
||||
/^Baz\.e$/i,
|
||||
/^Çər\.a$/i,
|
||||
/^Çər$/i,
|
||||
/^Cüm\.a$/i,
|
||||
/^Cüm$/i,
|
||||
/^Şə$/i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^Bazar$/i,
|
||||
/^Bazar ertəsi$/i,
|
||||
/^Çərşənbə axşamı$/i,
|
||||
/^Çərşənbə$/i,
|
||||
/^Cümə axşamı$/i,
|
||||
/^Cümə$/i,
|
||||
/^Şənbə$/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^B\.$/i,
|
||||
/^B\.e$/i,
|
||||
/^Ç\.a$/i,
|
||||
/^Ç\.$/i,
|
||||
/^C\.a$/i,
|
||||
/^C\.$/i,
|
||||
/^Ş\.$/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|gecəyarı|gün|səhər|gündüz|axşam|gecə)$/i,
|
||||
any: /^(am|pm|a\.m\.|p\.m\.|AM|PM|gecəyarı|gün|səhər|gündüz|axşam|gecə)$/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a$/i,
|
||||
pm: /^p$/i,
|
||||
midnight: /^gecəyarı$/i,
|
||||
noon: /^gün$/i,
|
||||
morning: /səhər$/i,
|
||||
afternoon: /gündüz$/i,
|
||||
evening: /axşam$/i,
|
||||
night: /gecə$/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "narrow",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./be-tarask/_lib/formatDistance.js";
|
||||
import { formatLong } from "./be-tarask/_lib/formatLong.js";
|
||||
import { formatRelative } from "./be-tarask/_lib/formatRelative.js";
|
||||
import { localize } from "./be-tarask/_lib/localize.js";
|
||||
import { match } from "./be-tarask/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Belarusian Classic locale.
|
||||
* @language Belarusian Classic
|
||||
* @iso-639-2 bel
|
||||
* @author Ryhor Nopears [@nopears](https://github.com/nopears)
|
||||
*/
|
||||
export const beTarask = {
|
||||
code: "be-tarask",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default beTarask;
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
function declension(scheme, count) {
|
||||
// scheme for count=1 exists
|
||||
if (scheme.one !== undefined && count === 1) {
|
||||
return scheme.one;
|
||||
}
|
||||
|
||||
const rem10 = count % 10;
|
||||
const rem100 = count % 100;
|
||||
|
||||
// 1, 21, 31, ...
|
||||
if (rem10 === 1 && rem100 !== 11) {
|
||||
return scheme.singularNominative.replace("{{count}}", String(count));
|
||||
|
||||
// 2, 3, 4, 22, 23, 24, 32 ...
|
||||
} else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) {
|
||||
return scheme.singularGenitive.replace("{{count}}", String(count));
|
||||
|
||||
// 5, 6, 7, 8, 9, 10, 11, ...
|
||||
} else {
|
||||
return scheme.pluralGenitive.replace("{{count}}", String(count));
|
||||
}
|
||||
}
|
||||
|
||||
function buildLocalizeTokenFn(scheme) {
|
||||
return (count, options) => {
|
||||
if (options && options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
if (scheme.future) {
|
||||
return declension(scheme.future, count);
|
||||
} else {
|
||||
return "праз " + declension(scheme.regular, count);
|
||||
}
|
||||
} else {
|
||||
if (scheme.past) {
|
||||
return declension(scheme.past, count);
|
||||
} else {
|
||||
return declension(scheme.regular, count) + " таму";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return declension(scheme.regular, count);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const halfAMinute = (_, options) => {
|
||||
if (options && options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "праз паўхвіліны";
|
||||
} else {
|
||||
return "паўхвіліны таму";
|
||||
}
|
||||
}
|
||||
|
||||
return "паўхвіліны";
|
||||
};
|
||||
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
one: "менш за секунду",
|
||||
singularNominative: "менш за {{count}} секунду",
|
||||
singularGenitive: "менш за {{count}} секунды",
|
||||
pluralGenitive: "менш за {{count}} секунд",
|
||||
},
|
||||
future: {
|
||||
one: "менш, чым праз секунду",
|
||||
singularNominative: "менш, чым праз {{count}} секунду",
|
||||
singularGenitive: "менш, чым праз {{count}} секунды",
|
||||
pluralGenitive: "менш, чым праз {{count}} секунд",
|
||||
},
|
||||
}),
|
||||
|
||||
xSeconds: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} секунда",
|
||||
singularGenitive: "{{count}} секунды",
|
||||
pluralGenitive: "{{count}} секунд",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} секунду таму",
|
||||
singularGenitive: "{{count}} секунды таму",
|
||||
pluralGenitive: "{{count}} секунд таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} секунду",
|
||||
singularGenitive: "праз {{count}} секунды",
|
||||
pluralGenitive: "праз {{count}} секунд",
|
||||
},
|
||||
}),
|
||||
|
||||
halfAMinute: halfAMinute,
|
||||
|
||||
lessThanXMinutes: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
one: "менш за хвіліну",
|
||||
singularNominative: "менш за {{count}} хвіліну",
|
||||
singularGenitive: "менш за {{count}} хвіліны",
|
||||
pluralGenitive: "менш за {{count}} хвілін",
|
||||
},
|
||||
future: {
|
||||
one: "менш, чым праз хвіліну",
|
||||
singularNominative: "менш, чым праз {{count}} хвіліну",
|
||||
singularGenitive: "менш, чым праз {{count}} хвіліны",
|
||||
pluralGenitive: "менш, чым праз {{count}} хвілін",
|
||||
},
|
||||
}),
|
||||
|
||||
xMinutes: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} хвіліна",
|
||||
singularGenitive: "{{count}} хвіліны",
|
||||
pluralGenitive: "{{count}} хвілін",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} хвіліну таму",
|
||||
singularGenitive: "{{count}} хвіліны таму",
|
||||
pluralGenitive: "{{count}} хвілін таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} хвіліну",
|
||||
singularGenitive: "праз {{count}} хвіліны",
|
||||
pluralGenitive: "праз {{count}} хвілін",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXHours: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} гадзіны",
|
||||
singularGenitive: "каля {{count}} гадзін",
|
||||
pluralGenitive: "каля {{count}} гадзін",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} гадзіну",
|
||||
singularGenitive: "прыблізна праз {{count}} гадзіны",
|
||||
pluralGenitive: "прыблізна праз {{count}} гадзін",
|
||||
},
|
||||
}),
|
||||
|
||||
xHours: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} гадзіна",
|
||||
singularGenitive: "{{count}} гадзіны",
|
||||
pluralGenitive: "{{count}} гадзін",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} гадзіну таму",
|
||||
singularGenitive: "{{count}} гадзіны таму",
|
||||
pluralGenitive: "{{count}} гадзін таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} гадзіну",
|
||||
singularGenitive: "праз {{count}} гадзіны",
|
||||
pluralGenitive: "праз {{count}} гадзін",
|
||||
},
|
||||
}),
|
||||
|
||||
xDays: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} дзень",
|
||||
singularGenitive: "{{count}} дні",
|
||||
pluralGenitive: "{{count}} дзён",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXWeeks: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} тыдні",
|
||||
singularGenitive: "каля {{count}} тыдняў",
|
||||
pluralGenitive: "каля {{count}} тыдняў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} тыдзень",
|
||||
singularGenitive: "прыблізна праз {{count}} тыдні",
|
||||
pluralGenitive: "прыблізна праз {{count}} тыдняў",
|
||||
},
|
||||
}),
|
||||
|
||||
xWeeks: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} тыдзень",
|
||||
singularGenitive: "{{count}} тыдні",
|
||||
pluralGenitive: "{{count}} тыдняў",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXMonths: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} месяца",
|
||||
singularGenitive: "каля {{count}} месяцаў",
|
||||
pluralGenitive: "каля {{count}} месяцаў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} месяц",
|
||||
singularGenitive: "прыблізна праз {{count}} месяцы",
|
||||
pluralGenitive: "прыблізна праз {{count}} месяцаў",
|
||||
},
|
||||
}),
|
||||
|
||||
xMonths: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} месяц",
|
||||
singularGenitive: "{{count}} месяцы",
|
||||
pluralGenitive: "{{count}} месяцаў",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} года",
|
||||
singularGenitive: "каля {{count}} гадоў",
|
||||
pluralGenitive: "каля {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} год",
|
||||
singularGenitive: "прыблізна праз {{count}} гады",
|
||||
pluralGenitive: "прыблізна праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
xYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} год",
|
||||
singularGenitive: "{{count}} гады",
|
||||
pluralGenitive: "{{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
overXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "больш за {{count}} год",
|
||||
singularGenitive: "больш за {{count}} гады",
|
||||
pluralGenitive: "больш за {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "больш, чым праз {{count}} год",
|
||||
singularGenitive: "больш, чым праз {{count}} гады",
|
||||
pluralGenitive: "больш, чым праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
almostXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "амаль {{count}} год",
|
||||
singularGenitive: "амаль {{count}} гады",
|
||||
pluralGenitive: "амаль {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "амаль праз {{count}} год",
|
||||
singularGenitive: "амаль праз {{count}} гады",
|
||||
pluralGenitive: "амаль праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
options = options || {};
|
||||
return formatDistanceLocale[token](count, options);
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d MMMM y 'г.'",
|
||||
long: "d MMMM y 'г.'",
|
||||
medium: "d MMM y 'г.'",
|
||||
short: "dd.MM.y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "H:mm:ss zzzz",
|
||||
long: "H:mm:ss z",
|
||||
medium: "H:mm:ss",
|
||||
short: "H:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
any: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "any",
|
||||
}),
|
||||
};
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
import { isSameWeek } from "../../../isSameWeek.js";
|
||||
import { toDate } from "../../../toDate.js";
|
||||
|
||||
const accusativeWeekdays = [
|
||||
"нядзелю",
|
||||
"панядзелак",
|
||||
"аўторак",
|
||||
"сераду",
|
||||
"чацьвер",
|
||||
"пятніцу",
|
||||
"суботу",
|
||||
];
|
||||
|
||||
function lastWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
return "'у мінулую " + weekday + " а' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
return "'у мінулы " + weekday + " а' p";
|
||||
}
|
||||
}
|
||||
|
||||
function thisWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
return "'у " + weekday + " а' p";
|
||||
}
|
||||
|
||||
function nextWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
return "'у наступную " + weekday + " а' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
return "'у наступны " + weekday + " а' p";
|
||||
}
|
||||
}
|
||||
|
||||
const lastWeekFormat = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return lastWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const nextWeekFormat = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return nextWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: lastWeekFormat,
|
||||
yesterday: "'учора а' p",
|
||||
today: "'сёньня а' p",
|
||||
tomorrow: "'заўтра а' p",
|
||||
nextWeek: nextWeekFormat,
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date, baseDate, options) => {
|
||||
const format = formatRelativeLocale[token];
|
||||
|
||||
if (typeof format === "function") {
|
||||
return format(date, baseDate, options);
|
||||
}
|
||||
|
||||
return format;
|
||||
};
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["да н.э.", "н.э."],
|
||||
abbreviated: ["да н. э.", "н. э."],
|
||||
wide: ["да нашай эры", "нашай эры"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["1-ы кв.", "2-і кв.", "3-і кв.", "4-ы кв."],
|
||||
wide: ["1-ы квартал", "2-і квартал", "3-і квартал", "4-ы квартал"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["С", "Л", "С", "К", "Т", "Ч", "Л", "Ж", "В", "К", "Л", "С"],
|
||||
abbreviated: [
|
||||
"студз.",
|
||||
"лют.",
|
||||
"сак.",
|
||||
"крас.",
|
||||
"трав.",
|
||||
"чэрв.",
|
||||
"ліп.",
|
||||
"жн.",
|
||||
"вер.",
|
||||
"кастр.",
|
||||
"ліст.",
|
||||
"сьнеж.",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"студзень",
|
||||
"люты",
|
||||
"сакавік",
|
||||
"красавік",
|
||||
"травень",
|
||||
"чэрвень",
|
||||
"ліпень",
|
||||
"жнівень",
|
||||
"верасень",
|
||||
"кастрычнік",
|
||||
"лістапад",
|
||||
"сьнежань",
|
||||
],
|
||||
};
|
||||
const formattingMonthValues = {
|
||||
narrow: ["С", "Л", "С", "К", "Т", "Ч", "Л", "Ж", "В", "К", "Л", "С"],
|
||||
abbreviated: [
|
||||
"студз.",
|
||||
"лют.",
|
||||
"сак.",
|
||||
"крас.",
|
||||
"трав.",
|
||||
"чэрв.",
|
||||
"ліп.",
|
||||
"жн.",
|
||||
"вер.",
|
||||
"кастр.",
|
||||
"ліст.",
|
||||
"сьнеж.",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"студзеня",
|
||||
"лютага",
|
||||
"сакавіка",
|
||||
"красавіка",
|
||||
"траўня",
|
||||
"чэрвеня",
|
||||
"ліпеня",
|
||||
"жніўня",
|
||||
"верасня",
|
||||
"кастрычніка",
|
||||
"лістапада",
|
||||
"сьнежня",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["Н", "П", "А", "С", "Ч", "П", "С"],
|
||||
short: ["нд", "пн", "аў", "ср", "чц", "пт", "сб"],
|
||||
abbreviated: ["нядз", "пан", "аўт", "сер", "чаць", "пят", "суб"],
|
||||
wide: [
|
||||
"нядзеля",
|
||||
"панядзелак",
|
||||
"аўторак",
|
||||
"серада",
|
||||
"чацьвер",
|
||||
"пятніца",
|
||||
"субота",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дзень",
|
||||
evening: "веч.",
|
||||
night: "ноч",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дзень",
|
||||
evening: "веч.",
|
||||
night: "ноч",
|
||||
},
|
||||
wide: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўнач",
|
||||
noon: "поўдзень",
|
||||
morning: "раніца",
|
||||
afternoon: "дзень",
|
||||
evening: "вечар",
|
||||
night: "ноч",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дня",
|
||||
evening: "веч.",
|
||||
night: "ночы",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дня",
|
||||
evening: "веч.",
|
||||
night: "ночы",
|
||||
},
|
||||
wide: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўнач",
|
||||
noon: "поўдзень",
|
||||
morning: "раніцы",
|
||||
afternoon: "дня",
|
||||
evening: "вечара",
|
||||
night: "ночы",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const unit = String(options?.unit);
|
||||
const number = Number(dirtyNumber);
|
||||
let suffix;
|
||||
|
||||
/** Though it's an incorrect ordinal form of a date we use it here for consistency with other similar locales (ru, uk)
|
||||
* For date-month combinations should be used `d` formatter.
|
||||
* Correct: `d MMMM` (4 верасня)
|
||||
* Incorrect: `do MMMM` (4-га верасня)
|
||||
*
|
||||
* But following the consistency leads to mistakes for literal uses of `do` formatter (ordinal day of month).
|
||||
* So for phrase "5th day of month" (`do дзень месяца`)
|
||||
* library will produce: `5-га дзень месяца`
|
||||
* but correct spelling should be: `5-ы дзень месяца`
|
||||
*
|
||||
* So I guess there should be a stand-alone and a formatting version of "day of month" formatters
|
||||
*/
|
||||
if (unit === "date") {
|
||||
suffix = "-га";
|
||||
} else if (unit === "hour" || unit === "minute" || unit === "second") {
|
||||
suffix = "-я";
|
||||
} else {
|
||||
suffix =
|
||||
(number % 10 === 2 || number % 10 === 3) &&
|
||||
number % 100 !== 12 &&
|
||||
number % 100 !== 13
|
||||
? "-і"
|
||||
: "-ы";
|
||||
}
|
||||
|
||||
return number + suffix;
|
||||
};
|
||||
|
||||
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",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "any",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
};
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern =
|
||||
/^(\d+)(-?(е|я|га|і|ы|ае|ая|яя|шы|гі|ці|ты|мы))?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^((да )?н\.?\s?э\.?)/i,
|
||||
abbreviated: /^((да )?н\.?\s?э\.?)/i,
|
||||
wide: /^(да нашай эры|нашай эры|наша эра)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^д/i, /^н/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^[1234](-?[ыі]?)? кв.?/i,
|
||||
wide: /^[1234](-?[ыі]?)? квартал/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[слкмчжв]/i,
|
||||
abbreviated:
|
||||
/^(студз|лют|сак|крас|тр(ав)?|чэрв|ліп|жн|вер|кастр|ліст|сьнеж)\.?/i,
|
||||
wide: /^(студзен[ья]|лют(ы|ага)|сакавіка?|красавіка?|тра(вень|ўня)|чэрвен[ья]|ліпен[ья]|жні(вень|ўня)|верас(ень|ня)|кастрычніка?|лістапада?|сьнеж(ань|ня))/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^с/i,
|
||||
/^л/i,
|
||||
/^с/i,
|
||||
/^к/i,
|
||||
/^т/i,
|
||||
/^ч/i,
|
||||
/^л/i,
|
||||
/^ж/i,
|
||||
/^в/i,
|
||||
/^к/i,
|
||||
/^л/i,
|
||||
/^с/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ст/i,
|
||||
/^лю/i,
|
||||
/^са/i,
|
||||
/^кр/i,
|
||||
/^тр/i,
|
||||
/^ч/i,
|
||||
/^ліп/i,
|
||||
/^ж/i,
|
||||
/^в/i,
|
||||
/^ка/i,
|
||||
/^ліс/i,
|
||||
/^сн/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[нпасч]/i,
|
||||
short: /^(нд|ня|пн|па|аў|ат|ср|се|чц|ча|пт|пя|сб|су)\.?/i,
|
||||
abbreviated: /^(нядз?|ндз|пнд|пан|аўт|срд|сер|чцьв|чаць|птн|пят|суб).?/i,
|
||||
wide: /^(нядзел[яі]|панядзел(ак|ка)|аўтор(ак|ка)|серад[аы]|чацьв(ер|ярга)|пятніц[аы]|субот[аы])/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^н/i, /^п/i, /^а/i, /^с/i, /^ч/i, /^п/i, /^с/i],
|
||||
any: [/^н/i, /^п[ан]/i, /^а/i, /^с[ер]/i, /^ч/i, /^п[ят]/i, /^с[уб]/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,
|
||||
abbreviated: /^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,
|
||||
wide: /^([дп]п|поўнач|поўдзень|раніц[аы]|дзень|дня|вечара?|ночы?)/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^дп/i,
|
||||
pm: /^пп/i,
|
||||
midnight: /^поўн/i,
|
||||
noon: /^поўд/i,
|
||||
morning: /^р/i,
|
||||
afternoon: /^д[зн]/i,
|
||||
evening: /^в/i,
|
||||
night: /^н/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./be/_lib/formatDistance.js";
|
||||
import { formatLong } from "./be/_lib/formatLong.js";
|
||||
import { formatRelative } from "./be/_lib/formatRelative.js";
|
||||
import { localize } from "./be/_lib/localize.js";
|
||||
import { match } from "./be/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Belarusian locale.
|
||||
* @language Belarusian
|
||||
* @iso-639-2 bel
|
||||
* @author Kiryl Anokhin [@alyrik](https://github.com/alyrik)
|
||||
* @author Martin Wind [@arvigeus](https://github.com/mawi12345)
|
||||
*/
|
||||
export const be = {
|
||||
code: "be",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default be;
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
function declension(scheme, count) {
|
||||
// scheme for count=1 exists
|
||||
if (scheme.one !== undefined && count === 1) {
|
||||
return scheme.one;
|
||||
}
|
||||
|
||||
const rem10 = count % 10;
|
||||
const rem100 = count % 100;
|
||||
|
||||
// 1, 21, 31, ...
|
||||
if (rem10 === 1 && rem100 !== 11) {
|
||||
return scheme.singularNominative.replace("{{count}}", String(count));
|
||||
|
||||
// 2, 3, 4, 22, 23, 24, 32 ...
|
||||
} else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) {
|
||||
return scheme.singularGenitive.replace("{{count}}", String(count));
|
||||
|
||||
// 5, 6, 7, 8, 9, 10, 11, ...
|
||||
} else {
|
||||
return scheme.pluralGenitive.replace("{{count}}", String(count));
|
||||
}
|
||||
}
|
||||
|
||||
function buildLocalizeTokenFn(scheme) {
|
||||
return (count, options) => {
|
||||
if (options && options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
if (scheme.future) {
|
||||
return declension(scheme.future, count);
|
||||
} else {
|
||||
return "праз " + declension(scheme.regular, count);
|
||||
}
|
||||
} else {
|
||||
if (scheme.past) {
|
||||
return declension(scheme.past, count);
|
||||
} else {
|
||||
return declension(scheme.regular, count) + " таму";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return declension(scheme.regular, count);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const halfAMinute = (_, options) => {
|
||||
if (options && options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "праз паўхвіліны";
|
||||
} else {
|
||||
return "паўхвіліны таму";
|
||||
}
|
||||
}
|
||||
|
||||
return "паўхвіліны";
|
||||
};
|
||||
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
one: "менш за секунду",
|
||||
singularNominative: "менш за {{count}} секунду",
|
||||
singularGenitive: "менш за {{count}} секунды",
|
||||
pluralGenitive: "менш за {{count}} секунд",
|
||||
},
|
||||
future: {
|
||||
one: "менш, чым праз секунду",
|
||||
singularNominative: "менш, чым праз {{count}} секунду",
|
||||
singularGenitive: "менш, чым праз {{count}} секунды",
|
||||
pluralGenitive: "менш, чым праз {{count}} секунд",
|
||||
},
|
||||
}),
|
||||
|
||||
xSeconds: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} секунда",
|
||||
singularGenitive: "{{count}} секунды",
|
||||
pluralGenitive: "{{count}} секунд",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} секунду таму",
|
||||
singularGenitive: "{{count}} секунды таму",
|
||||
pluralGenitive: "{{count}} секунд таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} секунду",
|
||||
singularGenitive: "праз {{count}} секунды",
|
||||
pluralGenitive: "праз {{count}} секунд",
|
||||
},
|
||||
}),
|
||||
|
||||
halfAMinute: halfAMinute,
|
||||
|
||||
lessThanXMinutes: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
one: "менш за хвіліну",
|
||||
singularNominative: "менш за {{count}} хвіліну",
|
||||
singularGenitive: "менш за {{count}} хвіліны",
|
||||
pluralGenitive: "менш за {{count}} хвілін",
|
||||
},
|
||||
future: {
|
||||
one: "менш, чым праз хвіліну",
|
||||
singularNominative: "менш, чым праз {{count}} хвіліну",
|
||||
singularGenitive: "менш, чым праз {{count}} хвіліны",
|
||||
pluralGenitive: "менш, чым праз {{count}} хвілін",
|
||||
},
|
||||
}),
|
||||
|
||||
xMinutes: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} хвіліна",
|
||||
singularGenitive: "{{count}} хвіліны",
|
||||
pluralGenitive: "{{count}} хвілін",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} хвіліну таму",
|
||||
singularGenitive: "{{count}} хвіліны таму",
|
||||
pluralGenitive: "{{count}} хвілін таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} хвіліну",
|
||||
singularGenitive: "праз {{count}} хвіліны",
|
||||
pluralGenitive: "праз {{count}} хвілін",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXHours: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} гадзіны",
|
||||
singularGenitive: "каля {{count}} гадзін",
|
||||
pluralGenitive: "каля {{count}} гадзін",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} гадзіну",
|
||||
singularGenitive: "прыблізна праз {{count}} гадзіны",
|
||||
pluralGenitive: "прыблізна праз {{count}} гадзін",
|
||||
},
|
||||
}),
|
||||
|
||||
xHours: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} гадзіна",
|
||||
singularGenitive: "{{count}} гадзіны",
|
||||
pluralGenitive: "{{count}} гадзін",
|
||||
},
|
||||
past: {
|
||||
singularNominative: "{{count}} гадзіну таму",
|
||||
singularGenitive: "{{count}} гадзіны таму",
|
||||
pluralGenitive: "{{count}} гадзін таму",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "праз {{count}} гадзіну",
|
||||
singularGenitive: "праз {{count}} гадзіны",
|
||||
pluralGenitive: "праз {{count}} гадзін",
|
||||
},
|
||||
}),
|
||||
|
||||
xDays: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} дзень",
|
||||
singularGenitive: "{{count}} дні",
|
||||
pluralGenitive: "{{count}} дзён",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXWeeks: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} тыдні",
|
||||
singularGenitive: "каля {{count}} тыдняў",
|
||||
pluralGenitive: "каля {{count}} тыдняў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} тыдзень",
|
||||
singularGenitive: "прыблізна праз {{count}} тыдні",
|
||||
pluralGenitive: "прыблізна праз {{count}} тыдняў",
|
||||
},
|
||||
}),
|
||||
|
||||
xWeeks: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} тыдзень",
|
||||
singularGenitive: "{{count}} тыдні",
|
||||
pluralGenitive: "{{count}} тыдняў",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXMonths: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} месяца",
|
||||
singularGenitive: "каля {{count}} месяцаў",
|
||||
pluralGenitive: "каля {{count}} месяцаў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} месяц",
|
||||
singularGenitive: "прыблізна праз {{count}} месяцы",
|
||||
pluralGenitive: "прыблізна праз {{count}} месяцаў",
|
||||
},
|
||||
}),
|
||||
|
||||
xMonths: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} месяц",
|
||||
singularGenitive: "{{count}} месяцы",
|
||||
pluralGenitive: "{{count}} месяцаў",
|
||||
},
|
||||
}),
|
||||
|
||||
aboutXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "каля {{count}} года",
|
||||
singularGenitive: "каля {{count}} гадоў",
|
||||
pluralGenitive: "каля {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "прыблізна праз {{count}} год",
|
||||
singularGenitive: "прыблізна праз {{count}} гады",
|
||||
pluralGenitive: "прыблізна праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
xYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "{{count}} год",
|
||||
singularGenitive: "{{count}} гады",
|
||||
pluralGenitive: "{{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
overXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "больш за {{count}} год",
|
||||
singularGenitive: "больш за {{count}} гады",
|
||||
pluralGenitive: "больш за {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "больш, чым праз {{count}} год",
|
||||
singularGenitive: "больш, чым праз {{count}} гады",
|
||||
pluralGenitive: "больш, чым праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
|
||||
almostXYears: buildLocalizeTokenFn({
|
||||
regular: {
|
||||
singularNominative: "амаль {{count}} год",
|
||||
singularGenitive: "амаль {{count}} гады",
|
||||
pluralGenitive: "амаль {{count}} гадоў",
|
||||
},
|
||||
future: {
|
||||
singularNominative: "амаль праз {{count}} год",
|
||||
singularGenitive: "амаль праз {{count}} гады",
|
||||
pluralGenitive: "амаль праз {{count}} гадоў",
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
options = options || {};
|
||||
return formatDistanceLocale[token](count, options);
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d MMMM y 'г.'",
|
||||
long: "d MMMM y 'г.'",
|
||||
medium: "d MMM y 'г.'",
|
||||
short: "dd.MM.y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "H:mm:ss zzzz",
|
||||
long: "H:mm:ss z",
|
||||
medium: "H:mm:ss",
|
||||
short: "H:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
any: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "any",
|
||||
}),
|
||||
};
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
import { isSameWeek } from "../../../isSameWeek.js";
|
||||
import { toDate } from "../../../toDate.js";
|
||||
|
||||
const accusativeWeekdays = [
|
||||
"нядзелю",
|
||||
"панядзелак",
|
||||
"аўторак",
|
||||
"сераду",
|
||||
"чацвер",
|
||||
"пятніцу",
|
||||
"суботу",
|
||||
];
|
||||
|
||||
function lastWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
return "'у мінулую " + weekday + " а' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
return "'у мінулы " + weekday + " а' p";
|
||||
}
|
||||
}
|
||||
|
||||
function thisWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
return "'у " + weekday + " а' p";
|
||||
}
|
||||
|
||||
function nextWeek(day) {
|
||||
const weekday = accusativeWeekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
return "'у наступную " + weekday + " а' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
return "'у наступны " + weekday + " а' p";
|
||||
}
|
||||
}
|
||||
|
||||
const lastWeekFormat = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return lastWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const nextWeekFormat = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return nextWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: lastWeekFormat,
|
||||
yesterday: "'учора а' p",
|
||||
today: "'сёння а' p",
|
||||
tomorrow: "'заўтра а' p",
|
||||
nextWeek: nextWeekFormat,
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date, baseDate, options) => {
|
||||
const format = formatRelativeLocale[token];
|
||||
|
||||
if (typeof format === "function") {
|
||||
return format(date, baseDate, options);
|
||||
}
|
||||
|
||||
return format;
|
||||
};
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["да н.э.", "н.э."],
|
||||
abbreviated: ["да н. э.", "н. э."],
|
||||
wide: ["да нашай эры", "нашай эры"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["1-ы кв.", "2-і кв.", "3-і кв.", "4-ы кв."],
|
||||
wide: ["1-ы квартал", "2-і квартал", "3-і квартал", "4-ы квартал"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["С", "Л", "С", "К", "М", "Ч", "Л", "Ж", "В", "К", "Л", "С"],
|
||||
abbreviated: [
|
||||
"студз.",
|
||||
"лют.",
|
||||
"сак.",
|
||||
"крас.",
|
||||
"май",
|
||||
"чэрв.",
|
||||
"ліп.",
|
||||
"жн.",
|
||||
"вер.",
|
||||
"кастр.",
|
||||
"ліст.",
|
||||
"снеж.",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"студзень",
|
||||
"люты",
|
||||
"сакавік",
|
||||
"красавік",
|
||||
"май",
|
||||
"чэрвень",
|
||||
"ліпень",
|
||||
"жнівень",
|
||||
"верасень",
|
||||
"кастрычнік",
|
||||
"лістапад",
|
||||
"снежань",
|
||||
],
|
||||
};
|
||||
const formattingMonthValues = {
|
||||
narrow: ["С", "Л", "С", "К", "М", "Ч", "Л", "Ж", "В", "К", "Л", "С"],
|
||||
abbreviated: [
|
||||
"студз.",
|
||||
"лют.",
|
||||
"сак.",
|
||||
"крас.",
|
||||
"мая",
|
||||
"чэрв.",
|
||||
"ліп.",
|
||||
"жн.",
|
||||
"вер.",
|
||||
"кастр.",
|
||||
"ліст.",
|
||||
"снеж.",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"студзеня",
|
||||
"лютага",
|
||||
"сакавіка",
|
||||
"красавіка",
|
||||
"мая",
|
||||
"чэрвеня",
|
||||
"ліпеня",
|
||||
"жніўня",
|
||||
"верасня",
|
||||
"кастрычніка",
|
||||
"лістапада",
|
||||
"снежня",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["Н", "П", "А", "С", "Ч", "П", "С"],
|
||||
short: ["нд", "пн", "аў", "ср", "чц", "пт", "сб"],
|
||||
abbreviated: ["нядз", "пан", "аўт", "сер", "чац", "пят", "суб"],
|
||||
wide: [
|
||||
"нядзеля",
|
||||
"панядзелак",
|
||||
"аўторак",
|
||||
"серада",
|
||||
"чацвер",
|
||||
"пятніца",
|
||||
"субота",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дзень",
|
||||
evening: "веч.",
|
||||
night: "ноч",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дзень",
|
||||
evening: "веч.",
|
||||
night: "ноч",
|
||||
},
|
||||
wide: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўнач",
|
||||
noon: "поўдзень",
|
||||
morning: "раніца",
|
||||
afternoon: "дзень",
|
||||
evening: "вечар",
|
||||
night: "ноч",
|
||||
},
|
||||
};
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дня",
|
||||
evening: "веч.",
|
||||
night: "ночы",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўн.",
|
||||
noon: "поўд.",
|
||||
morning: "ран.",
|
||||
afternoon: "дня",
|
||||
evening: "веч.",
|
||||
night: "ночы",
|
||||
},
|
||||
wide: {
|
||||
am: "ДП",
|
||||
pm: "ПП",
|
||||
midnight: "поўнач",
|
||||
noon: "поўдзень",
|
||||
morning: "раніцы",
|
||||
afternoon: "дня",
|
||||
evening: "вечара",
|
||||
night: "ночы",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const unit = String(options?.unit);
|
||||
const number = Number(dirtyNumber);
|
||||
let suffix;
|
||||
|
||||
/** Though it's an incorrect ordinal form of a date we use it here for consistency with other similar locales (ru, uk)
|
||||
* For date-month combinations should be used `d` formatter.
|
||||
* Correct: `d MMMM` (4 верасня)
|
||||
* Incorrect: `do MMMM` (4-га верасня)
|
||||
*
|
||||
* But following the consistency leads to mistakes for literal uses of `do` formatter (ordinal day of month).
|
||||
* So for phrase "5th day of month" (`do дзень месяца`)
|
||||
* library will produce: `5-га дзень месяца`
|
||||
* but correct spelling should be: `5-ы дзень месяца`
|
||||
*
|
||||
* So I guess there should be a stand-alone and a formatting version of "day of month" formatters
|
||||
*/
|
||||
if (unit === "date") {
|
||||
suffix = "-га";
|
||||
} else if (unit === "hour" || unit === "minute" || unit === "second") {
|
||||
suffix = "-я";
|
||||
} else {
|
||||
suffix =
|
||||
(number % 10 === 2 || number % 10 === 3) &&
|
||||
number % 100 !== 12 &&
|
||||
number % 100 !== 13
|
||||
? "-і"
|
||||
: "-ы";
|
||||
}
|
||||
|
||||
return number + suffix;
|
||||
};
|
||||
|
||||
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",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "any",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
};
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern =
|
||||
/^(\d+)(-?(е|я|га|і|ы|ае|ая|яя|шы|гі|ці|ты|мы))?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^((да )?н\.?\s?э\.?)/i,
|
||||
abbreviated: /^((да )?н\.?\s?э\.?)/i,
|
||||
wide: /^(да нашай эры|нашай эры|наша эра)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^д/i, /^н/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^[1234](-?[ыі]?)? кв.?/i,
|
||||
wide: /^[1234](-?[ыі]?)? квартал/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[слкмчжв]/i,
|
||||
abbreviated:
|
||||
/^(студз|лют|сак|крас|ма[йя]|чэрв|ліп|жн|вер|кастр|ліст|снеж)\.?/i,
|
||||
wide: /^(студзен[ья]|лют(ы|ага)|сакавіка?|красавіка?|ма[йя]|чэрвен[ья]|ліпен[ья]|жні(вень|ўня)|верас(ень|ня)|кастрычніка?|лістапада?|снеж(ань|ня))/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^с/i,
|
||||
/^л/i,
|
||||
/^с/i,
|
||||
/^к/i,
|
||||
/^м/i,
|
||||
/^ч/i,
|
||||
/^л/i,
|
||||
/^ж/i,
|
||||
/^в/i,
|
||||
/^к/i,
|
||||
/^л/i,
|
||||
/^с/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ст/i,
|
||||
/^лю/i,
|
||||
/^са/i,
|
||||
/^кр/i,
|
||||
/^ма/i,
|
||||
/^ч/i,
|
||||
/^ліп/i,
|
||||
/^ж/i,
|
||||
/^в/i,
|
||||
/^ка/i,
|
||||
/^ліс/i,
|
||||
/^сн/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[нпасч]/i,
|
||||
short: /^(нд|ня|пн|па|аў|ат|ср|се|чц|ча|пт|пя|сб|су)\.?/i,
|
||||
abbreviated: /^(нядз?|ндз|пнд|пан|аўт|срд|сер|чцв|чац|птн|пят|суб).?/i,
|
||||
wide: /^(нядзел[яі]|панядзел(ак|ка)|аўтор(ак|ка)|серад[аы]|чацв(ер|ярга)|пятніц[аы]|субот[аы])/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^н/i, /^п/i, /^а/i, /^с/i, /^ч/i, /^п/i, /^с/i],
|
||||
any: [/^н/i, /^п[ан]/i, /^а/i, /^с[ер]/i, /^ч/i, /^п[ят]/i, /^с[уб]/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,
|
||||
abbreviated: /^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,
|
||||
wide: /^([дп]п|поўнач|поўдзень|раніц[аы]|дзень|дня|вечара?|ночы?)/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^дп/i,
|
||||
pm: /^пп/i,
|
||||
midnight: /^поўн/i,
|
||||
noon: /^поўд/i,
|
||||
morning: /^р/i,
|
||||
afternoon: /^д[зн]/i,
|
||||
evening: /^в/i,
|
||||
night: /^н/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./bg/_lib/formatDistance.js";
|
||||
import { formatLong } from "./bg/_lib/formatLong.js";
|
||||
import { formatRelative } from "./bg/_lib/formatRelative.js";
|
||||
import { localize } from "./bg/_lib/localize.js";
|
||||
import { match } from "./bg/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Bulgarian locale.
|
||||
* @language Bulgarian
|
||||
* @iso-639-2 bul
|
||||
* @author Nikolay Stoynov [@arvigeus](https://github.com/arvigeus)
|
||||
* @author Tsvetan Ovedenski [@fintara](https://github.com/fintara)
|
||||
*/
|
||||
export const bg = {
|
||||
code: "bg",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default bg;
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "по-малко от секунда",
|
||||
other: "по-малко от {{count}} секунди",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 секунда",
|
||||
other: "{{count}} секунди",
|
||||
},
|
||||
|
||||
halfAMinute: "половин минута",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "по-малко от минута",
|
||||
other: "по-малко от {{count}} минути",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "1 минута",
|
||||
other: "{{count}} минути",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "около час",
|
||||
other: "около {{count}} часа",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 час",
|
||||
other: "{{count}} часа",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 ден",
|
||||
other: "{{count}} дни",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "около седмица",
|
||||
other: "около {{count}} седмици",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 седмица",
|
||||
other: "{{count}} седмици",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "около месец",
|
||||
other: "около {{count}} месеца",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 месец",
|
||||
other: "{{count}} месеца",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "около година",
|
||||
other: "около {{count}} години",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 година",
|
||||
other: "{{count}} години",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "над година",
|
||||
other: "над {{count}} години",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "почти година",
|
||||
other: "почти {{count}} години",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "след " + result;
|
||||
} else {
|
||||
return "преди " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, dd MMMM yyyy",
|
||||
long: "dd MMMM yyyy",
|
||||
medium: "dd MMM yyyy",
|
||||
short: "dd.MM.yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss zzzz",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "H:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
any: "{{date}} {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "any",
|
||||
}),
|
||||
};
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
import { isSameWeek } from "../../../isSameWeek.js";
|
||||
import { toDate } from "../../../toDate.js";
|
||||
|
||||
// Adapted from the `ru` translation
|
||||
|
||||
const weekdays = [
|
||||
"неделя",
|
||||
"понеделник",
|
||||
"вторник",
|
||||
"сряда",
|
||||
"четвъртък",
|
||||
"петък",
|
||||
"събота",
|
||||
];
|
||||
|
||||
function lastWeek(day) {
|
||||
const weekday = weekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 6:
|
||||
return "'миналата " + weekday + " в' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
return "'миналия " + weekday + " в' p";
|
||||
}
|
||||
}
|
||||
|
||||
function thisWeek(day) {
|
||||
const weekday = weekdays[day];
|
||||
|
||||
if (day === 2 /* Tue */) {
|
||||
return "'във " + weekday + " в' p";
|
||||
} else {
|
||||
return "'в " + weekday + " в' p";
|
||||
}
|
||||
}
|
||||
|
||||
function nextWeek(day) {
|
||||
const weekday = weekdays[day];
|
||||
|
||||
switch (day) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 6:
|
||||
return "'следващата " + weekday + " в' p";
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
return "'следващия " + weekday + " в' p";
|
||||
}
|
||||
}
|
||||
|
||||
const lastWeekFormatToken = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return lastWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const nextWeekFormatToken = (dirtyDate, baseDate, options) => {
|
||||
const date = toDate(dirtyDate);
|
||||
const day = date.getDay();
|
||||
if (isSameWeek(date, baseDate, options)) {
|
||||
return thisWeek(day);
|
||||
} else {
|
||||
return nextWeek(day);
|
||||
}
|
||||
};
|
||||
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: lastWeekFormatToken,
|
||||
yesterday: "'вчера в' p",
|
||||
today: "'днес в' p",
|
||||
tomorrow: "'утре в' p",
|
||||
nextWeek: nextWeekFormatToken,
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date, baseDate, options) => {
|
||||
const format = formatRelativeLocale[token];
|
||||
|
||||
if (typeof format === "function") {
|
||||
return format(date, baseDate, options);
|
||||
}
|
||||
|
||||
return format;
|
||||
};
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["пр.н.е.", "н.е."],
|
||||
abbreviated: ["преди н. е.", "н. е."],
|
||||
wide: ["преди новата ера", "новата ера"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["1-во тримес.", "2-ро тримес.", "3-то тримес.", "4-то тримес."],
|
||||
|
||||
wide: [
|
||||
"1-во тримесечие",
|
||||
"2-ро тримесечие",
|
||||
"3-то тримесечие",
|
||||
"4-то тримесечие",
|
||||
],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
abbreviated: [
|
||||
"яну",
|
||||
"фев",
|
||||
"мар",
|
||||
"апр",
|
||||
"май",
|
||||
"юни",
|
||||
"юли",
|
||||
"авг",
|
||||
"сеп",
|
||||
"окт",
|
||||
"ное",
|
||||
"дек",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"януари",
|
||||
"февруари",
|
||||
"март",
|
||||
"април",
|
||||
"май",
|
||||
"юни",
|
||||
"юли",
|
||||
"август",
|
||||
"септември",
|
||||
"октомври",
|
||||
"ноември",
|
||||
"декември",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["Н", "П", "В", "С", "Ч", "П", "С"],
|
||||
short: ["нд", "пн", "вт", "ср", "чт", "пт", "сб"],
|
||||
abbreviated: ["нед", "пон", "вто", "сря", "чет", "пет", "съб"],
|
||||
wide: [
|
||||
"неделя",
|
||||
"понеделник",
|
||||
"вторник",
|
||||
"сряда",
|
||||
"четвъртък",
|
||||
"петък",
|
||||
"събота",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
wide: {
|
||||
am: "преди обяд",
|
||||
pm: "след обяд",
|
||||
midnight: "в полунощ",
|
||||
noon: "на обяд",
|
||||
morning: "сутринта",
|
||||
afternoon: "следобед",
|
||||
evening: "вечерта",
|
||||
night: "през нощта",
|
||||
},
|
||||
};
|
||||
|
||||
function isFeminine(unit) {
|
||||
return (
|
||||
unit === "year" || unit === "week" || unit === "minute" || unit === "second"
|
||||
);
|
||||
}
|
||||
|
||||
function isNeuter(unit) {
|
||||
return unit === "quarter";
|
||||
}
|
||||
|
||||
function numberWithSuffix(number, unit, masculine, feminine, neuter) {
|
||||
const suffix = isNeuter(unit)
|
||||
? neuter
|
||||
: isFeminine(unit)
|
||||
? feminine
|
||||
: masculine;
|
||||
return number + "-" + suffix;
|
||||
}
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const unit = options?.unit;
|
||||
|
||||
if (number === 0) {
|
||||
return numberWithSuffix(0, unit, "ев", "ева", "ево");
|
||||
} else if (number % 1000 === 0) {
|
||||
return numberWithSuffix(number, unit, "ен", "на", "но");
|
||||
} else if (number % 100 === 0) {
|
||||
return numberWithSuffix(number, unit, "тен", "тна", "тно");
|
||||
}
|
||||
|
||||
const rem100 = number % 100;
|
||||
if (rem100 > 20 || rem100 < 10) {
|
||||
switch (rem100 % 10) {
|
||||
case 1:
|
||||
return numberWithSuffix(number, unit, "ви", "ва", "во");
|
||||
case 2:
|
||||
return numberWithSuffix(number, unit, "ри", "ра", "ро");
|
||||
case 7:
|
||||
case 8:
|
||||
return numberWithSuffix(number, unit, "ми", "ма", "мо");
|
||||
}
|
||||
}
|
||||
|
||||
return numberWithSuffix(number, unit, "ти", "та", "то");
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern =
|
||||
/^(\d+)(-?[врмт][аи]|-?т?(ен|на)|-?(ев|ева))?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^((пр)?н\.?\s?е\.?)/i,
|
||||
abbreviated: /^((пр)?н\.?\s?е\.?)/i,
|
||||
wide: /^(преди новата ера|новата ера|нова ера)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^п/i, /^н/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^[1234](-?[врт]?o?)? тримес.?/i,
|
||||
wide: /^[1234](-?[врт]?о?)? тримесечие/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[нпвсч]/i,
|
||||
short: /^(нд|пн|вт|ср|чт|пт|сб)/i,
|
||||
abbreviated: /^(нед|пон|вто|сря|чет|пет|съб)/i,
|
||||
wide: /^(неделя|понеделник|вторник|сряда|четвъртък|петък|събота)/i,
|
||||
};
|
||||
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^н/i, /^п/i, /^в/i, /^с/i, /^ч/i, /^п/i, /^с/i],
|
||||
any: [/^н[ед]/i, /^п[он]/i, /^вт/i, /^ср/i, /^ч[ет]/i, /^п[ет]/i, /^с[ъб]/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
abbreviated: /^(яну|фев|мар|апр|май|юни|юли|авг|сеп|окт|ное|дек)/i,
|
||||
wide: /^(януари|февруари|март|април|май|юни|юли|август|септември|октомври|ноември|декември)/i,
|
||||
};
|
||||
|
||||
const parseMonthPatterns = {
|
||||
any: [
|
||||
/^я/i,
|
||||
/^ф/i,
|
||||
/^мар/i,
|
||||
/^ап/i,
|
||||
/^май/i,
|
||||
/^юн/i,
|
||||
/^юл/i,
|
||||
/^ав/i,
|
||||
/^се/i,
|
||||
/^окт/i,
|
||||
/^но/i,
|
||||
/^де/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
any: /^(преди о|след о|в по|на о|през|веч|сут|следо)/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^преди о/i,
|
||||
pm: /^след о/i,
|
||||
midnight: /^в пол/i,
|
||||
noon: /^на об/i,
|
||||
morning: /^сут/i,
|
||||
afternoon: /^следо/i,
|
||||
evening: /^веч/i,
|
||||
night: /^през н/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./bn/_lib/formatDistance.js";
|
||||
import { formatLong } from "./bn/_lib/formatLong.js";
|
||||
import { formatRelative } from "./bn/_lib/formatRelative.js";
|
||||
import { localize } from "./bn/_lib/localize.js";
|
||||
import { match } from "./bn/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Bengali locale.
|
||||
* @language Bengali
|
||||
* @iso-639-2 ben
|
||||
* @author Touhidur Rahman [@touhidrahman](https://github.com/touhidrahman)
|
||||
* @author Farhad Yasir [@nutboltu](https://github.com/nutboltu)
|
||||
*/
|
||||
export const bn = {
|
||||
code: "bn",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default bn;
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
import { numberToLocale } from "./localize.js";
|
||||
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "প্রায় ১ সেকেন্ড",
|
||||
other: "প্রায় {{count}} সেকেন্ড",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "১ সেকেন্ড",
|
||||
other: "{{count}} সেকেন্ড",
|
||||
},
|
||||
|
||||
halfAMinute: "আধ মিনিট",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "প্রায় ১ মিনিট",
|
||||
other: "প্রায় {{count}} মিনিট",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "১ মিনিট",
|
||||
other: "{{count}} মিনিট",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "প্রায় ১ ঘন্টা",
|
||||
other: "প্রায় {{count}} ঘন্টা",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "১ ঘন্টা",
|
||||
other: "{{count}} ঘন্টা",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "১ দিন",
|
||||
other: "{{count}} দিন",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "প্রায় ১ সপ্তাহ",
|
||||
other: "প্রায় {{count}} সপ্তাহ",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "১ সপ্তাহ",
|
||||
other: "{{count}} সপ্তাহ",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "প্রায় ১ মাস",
|
||||
other: "প্রায় {{count}} মাস",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "১ মাস",
|
||||
other: "{{count}} মাস",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "প্রায় ১ বছর",
|
||||
other: "প্রায় {{count}} বছর",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "১ বছর",
|
||||
other: "{{count}} বছর",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "১ বছরের বেশি",
|
||||
other: "{{count}} বছরের বেশি",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "প্রায় ১ বছর",
|
||||
other: "প্রায় {{count}} বছর",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", numberToLocale(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return result + " এর মধ্যে";
|
||||
} else {
|
||||
return result + " আগে";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, MMMM do, y",
|
||||
long: "MMMM do, y",
|
||||
medium: "MMM d, y",
|
||||
short: "MM/dd/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} {{time}} 'সময়'",
|
||||
long: "{{date}} {{time}} 'সময়'",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'গত' eeee 'সময়' p",
|
||||
yesterday: "'গতকাল' 'সময়' p",
|
||||
today: "'আজ' 'সময়' p",
|
||||
tomorrow: "'আগামীকাল' 'সময়' p",
|
||||
nextWeek: "eeee 'সময়' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const numberValues = {
|
||||
locale: {
|
||||
1: "১",
|
||||
2: "২",
|
||||
3: "৩",
|
||||
4: "৪",
|
||||
5: "৫",
|
||||
6: "৬",
|
||||
7: "৭",
|
||||
8: "৮",
|
||||
9: "৯",
|
||||
0: "০",
|
||||
},
|
||||
number: {
|
||||
"১": "1",
|
||||
"২": "2",
|
||||
"৩": "3",
|
||||
"৪": "4",
|
||||
"৫": "5",
|
||||
"৬": "6",
|
||||
"৭": "7",
|
||||
"৮": "8",
|
||||
"৯": "9",
|
||||
"০": "0",
|
||||
},
|
||||
};
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["খ্রিঃপূঃ", "খ্রিঃ"],
|
||||
abbreviated: ["খ্রিঃপূর্ব", "খ্রিঃ"],
|
||||
wide: ["খ্রিস্টপূর্ব", "খ্রিস্টাব্দ"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["১", "২", "৩", "৪"],
|
||||
abbreviated: ["১ত্রৈ", "২ত্রৈ", "৩ত্রৈ", "৪ত্রৈ"],
|
||||
wide: ["১ম ত্রৈমাসিক", "২য় ত্রৈমাসিক", "৩য় ত্রৈমাসিক", "৪র্থ ত্রৈমাসিক"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: [
|
||||
"জানু",
|
||||
"ফেব্রু",
|
||||
"মার্চ",
|
||||
"এপ্রিল",
|
||||
"মে",
|
||||
"জুন",
|
||||
"জুলাই",
|
||||
"আগস্ট",
|
||||
"সেপ্ট",
|
||||
"অক্টো",
|
||||
"নভে",
|
||||
"ডিসে",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"জানু",
|
||||
"ফেব্রু",
|
||||
"মার্চ",
|
||||
"এপ্রিল",
|
||||
"মে",
|
||||
"জুন",
|
||||
"জুলাই",
|
||||
"আগস্ট",
|
||||
"সেপ্ট",
|
||||
"অক্টো",
|
||||
"নভে",
|
||||
"ডিসে",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"জানুয়ারি",
|
||||
"ফেব্রুয়ারি",
|
||||
"মার্চ",
|
||||
"এপ্রিল",
|
||||
"মে",
|
||||
"জুন",
|
||||
"জুলাই",
|
||||
"আগস্ট",
|
||||
"সেপ্টেম্বর",
|
||||
"অক্টোবর",
|
||||
"নভেম্বর",
|
||||
"ডিসেম্বর",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["র", "সো", "ম", "বু", "বৃ", "শু", "শ"],
|
||||
short: ["রবি", "সোম", "মঙ্গল", "বুধ", "বৃহ", "শুক্র", "শনি"],
|
||||
abbreviated: ["রবি", "সোম", "মঙ্গল", "বুধ", "বৃহ", "শুক্র", "শনি"],
|
||||
wide: [
|
||||
"রবিবার",
|
||||
"সোমবার",
|
||||
"মঙ্গলবার",
|
||||
"বুধবার",
|
||||
"বৃহস্পতিবার ",
|
||||
"শুক্রবার",
|
||||
"শনিবার",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "পূ",
|
||||
pm: "অপ",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "পূর্বাহ্ন",
|
||||
pm: "অপরাহ্ন",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
wide: {
|
||||
am: "পূর্বাহ্ন",
|
||||
pm: "অপরাহ্ন",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "পূ",
|
||||
pm: "অপ",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "পূর্বাহ্ন",
|
||||
pm: "অপরাহ্ন",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
wide: {
|
||||
am: "পূর্বাহ্ন",
|
||||
pm: "অপরাহ্ন",
|
||||
midnight: "মধ্যরাত",
|
||||
noon: "মধ্যাহ্ন",
|
||||
morning: "সকাল",
|
||||
afternoon: "বিকাল",
|
||||
evening: "সন্ধ্যা",
|
||||
night: "রাত",
|
||||
},
|
||||
};
|
||||
|
||||
function dateOrdinalNumber(number, localeNumber) {
|
||||
if (number > 18 && number <= 31) {
|
||||
return localeNumber + "শে";
|
||||
} else {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return localeNumber + "লা";
|
||||
case 2:
|
||||
case 3:
|
||||
return localeNumber + "রা";
|
||||
case 4:
|
||||
return localeNumber + "ঠা";
|
||||
default:
|
||||
return localeNumber + "ই";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const localeNumber = numberToLocale(number);
|
||||
const unit = options?.unit;
|
||||
|
||||
if (unit === "date") {
|
||||
return dateOrdinalNumber(number, localeNumber);
|
||||
}
|
||||
if (number > 10 || number === 0) return localeNumber + "তম";
|
||||
|
||||
const rem10 = number % 10;
|
||||
switch (rem10) {
|
||||
case 2:
|
||||
case 3:
|
||||
return localeNumber + "য়";
|
||||
case 4:
|
||||
return localeNumber + "র্থ";
|
||||
case 6:
|
||||
return localeNumber + "ষ্ঠ";
|
||||
default:
|
||||
return localeNumber + "ম";
|
||||
}
|
||||
};
|
||||
|
||||
// function localeToNumber(locale: string): number {
|
||||
// const enNumber = locale.toString().replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
|
||||
// return numberValues.number[match as keyof typeof numberValues.number]
|
||||
// })
|
||||
// return Number(enNumber)
|
||||
// }
|
||||
|
||||
export function numberToLocale(enNumber) {
|
||||
return enNumber.toString().replace(/\d/g, function (match) {
|
||||
return numberValues.locale[match];
|
||||
});
|
||||
}
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(ম|য়|র্থ|ষ্ঠ|শে|ই|তম)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(খ্রিঃপূঃ|খ্রিঃ)/i,
|
||||
abbreviated: /^(খ্রিঃপূর্ব|খ্রিঃ)/i,
|
||||
wide: /^(খ্রিস্টপূর্ব|খ্রিস্টাব্দ)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
narrow: [/^খ্রিঃপূঃ/i, /^খ্রিঃ/i],
|
||||
abbreviated: [/^খ্রিঃপূর্ব/i, /^খ্রিঃ/i],
|
||||
wide: [/^খ্রিস্টপূর্ব/i, /^খ্রিস্টাব্দ/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[১২৩৪]/i,
|
||||
abbreviated: /^[১২৩৪]ত্রৈ/i,
|
||||
wide: /^[১২৩৪](ম|য়|র্থ)? ত্রৈমাসিক/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/১/i, /২/i, /৩/i, /৪/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow:
|
||||
/^(জানু|ফেব্রু|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগস্ট|সেপ্ট|অক্টো|নভে|ডিসে)/i,
|
||||
abbreviated:
|
||||
/^(জানু|ফেব্রু|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগস্ট|সেপ্ট|অক্টো|নভে|ডিসে)/i,
|
||||
wide: /^(জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগস্ট|সেপ্টেম্বর|অক্টোবর|নভেম্বর|ডিসেম্বর)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
any: [
|
||||
/^জানু/i,
|
||||
/^ফেব্রু/i,
|
||||
/^মার্চ/i,
|
||||
/^এপ্রিল/i,
|
||||
/^মে/i,
|
||||
/^জুন/i,
|
||||
/^জুলাই/i,
|
||||
/^আগস্ট/i,
|
||||
/^সেপ্ট/i,
|
||||
/^অক্টো/i,
|
||||
/^নভে/i,
|
||||
/^ডিসে/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(র|সো|ম|বু|বৃ|শু|শ)+/i,
|
||||
short: /^(রবি|সোম|মঙ্গল|বুধ|বৃহ|শুক্র|শনি)+/i,
|
||||
abbreviated: /^(রবি|সোম|মঙ্গল|বুধ|বৃহ|শুক্র|শনি)+/i,
|
||||
wide: /^(রবিবার|সোমবার|মঙ্গলবার|বুধবার|বৃহস্পতিবার |শুক্রবার|শনিবার)+/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^র/i, /^সো/i, /^ম/i, /^বু/i, /^বৃ/i, /^শু/i, /^শ/i],
|
||||
short: [/^রবি/i, /^সোম/i, /^মঙ্গল/i, /^বুধ/i, /^বৃহ/i, /^শুক্র/i, /^শনি/i],
|
||||
|
||||
abbreviated: [
|
||||
/^রবি/i,
|
||||
/^সোম/i,
|
||||
/^মঙ্গল/i,
|
||||
/^বুধ/i,
|
||||
/^বৃহ/i,
|
||||
/^শুক্র/i,
|
||||
/^শনি/i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^রবিবার/i,
|
||||
/^সোমবার/i,
|
||||
/^মঙ্গলবার/i,
|
||||
/^বুধবার/i,
|
||||
/^বৃহস্পতিবার /i,
|
||||
/^শুক্রবার/i,
|
||||
/^শনিবার/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(পূ|অপ|মধ্যরাত|মধ্যাহ্ন|সকাল|বিকাল|সন্ধ্যা|রাত)/i,
|
||||
abbreviated: /^(পূর্বাহ্ন|অপরাহ্ন|মধ্যরাত|মধ্যাহ্ন|সকাল|বিকাল|সন্ধ্যা|রাত)/i,
|
||||
wide: /^(পূর্বাহ্ন|অপরাহ্ন|মধ্যরাত|মধ্যাহ্ন|সকাল|বিকাল|সন্ধ্যা|রাত)/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^পূ/i,
|
||||
pm: /^অপ/i,
|
||||
midnight: /^মধ্যরাত/i,
|
||||
noon: /^মধ্যাহ্ন/i,
|
||||
morning: /সকাল/i,
|
||||
afternoon: /বিকাল/i,
|
||||
evening: /সন্ধ্যা/i,
|
||||
night: /রাত/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { formatDistance } from "./bs/_lib/formatDistance.js";
|
||||
import { formatLong } from "./bs/_lib/formatLong.js";
|
||||
import { formatRelative } from "./bs/_lib/formatRelative.js";
|
||||
import { localize } from "./bs/_lib/localize.js";
|
||||
import { match } from "./bs/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Bosnian locale.
|
||||
* @language Bosnian
|
||||
* @iso-639-2 bos
|
||||
* @author Branislav Lazić [@branislavlazic](https://github.com/branislavlazic)
|
||||
*/
|
||||
export const bs = {
|
||||
code: "bs",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 4,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default bs;
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: {
|
||||
standalone: "manje od 1 sekunde",
|
||||
withPrepositionAgo: "manje od 1 sekunde",
|
||||
withPrepositionIn: "manje od 1 sekundu",
|
||||
},
|
||||
dual: "manje od {{count}} sekunde",
|
||||
other: "manje od {{count}} sekundi",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: {
|
||||
standalone: "1 sekunda",
|
||||
withPrepositionAgo: "1 sekunde",
|
||||
withPrepositionIn: "1 sekundu",
|
||||
},
|
||||
dual: "{{count}} sekunde",
|
||||
other: "{{count}} sekundi",
|
||||
},
|
||||
|
||||
halfAMinute: "pola minute",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: {
|
||||
standalone: "manje od 1 minute",
|
||||
withPrepositionAgo: "manje od 1 minute",
|
||||
withPrepositionIn: "manje od 1 minutu",
|
||||
},
|
||||
dual: "manje od {{count}} minute",
|
||||
other: "manje od {{count}} minuta",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: {
|
||||
standalone: "1 minuta",
|
||||
withPrepositionAgo: "1 minute",
|
||||
withPrepositionIn: "1 minutu",
|
||||
},
|
||||
dual: "{{count}} minute",
|
||||
other: "{{count}} minuta",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: {
|
||||
standalone: "oko 1 sat",
|
||||
withPrepositionAgo: "oko 1 sat",
|
||||
withPrepositionIn: "oko 1 sat",
|
||||
},
|
||||
dual: "oko {{count}} sata",
|
||||
other: "oko {{count}} sati",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: {
|
||||
standalone: "1 sat",
|
||||
withPrepositionAgo: "1 sat",
|
||||
withPrepositionIn: "1 sat",
|
||||
},
|
||||
dual: "{{count}} sata",
|
||||
other: "{{count}} sati",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: {
|
||||
standalone: "1 dan",
|
||||
withPrepositionAgo: "1 dan",
|
||||
withPrepositionIn: "1 dan",
|
||||
},
|
||||
dual: "{{count}} dana",
|
||||
other: "{{count}} dana",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: {
|
||||
standalone: "oko 1 sedmicu",
|
||||
withPrepositionAgo: "oko 1 sedmicu",
|
||||
withPrepositionIn: "oko 1 sedmicu",
|
||||
},
|
||||
dual: "oko {{count}} sedmice",
|
||||
other: "oko {{count}} sedmice",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: {
|
||||
standalone: "1 sedmicu",
|
||||
withPrepositionAgo: "1 sedmicu",
|
||||
withPrepositionIn: "1 sedmicu",
|
||||
},
|
||||
dual: "{{count}} sedmice",
|
||||
other: "{{count}} sedmice",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: {
|
||||
standalone: "oko 1 mjesec",
|
||||
withPrepositionAgo: "oko 1 mjesec",
|
||||
withPrepositionIn: "oko 1 mjesec",
|
||||
},
|
||||
dual: "oko {{count}} mjeseca",
|
||||
other: "oko {{count}} mjeseci",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: {
|
||||
standalone: "1 mjesec",
|
||||
withPrepositionAgo: "1 mjesec",
|
||||
withPrepositionIn: "1 mjesec",
|
||||
},
|
||||
dual: "{{count}} mjeseca",
|
||||
other: "{{count}} mjeseci",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: {
|
||||
standalone: "oko 1 godinu",
|
||||
withPrepositionAgo: "oko 1 godinu",
|
||||
withPrepositionIn: "oko 1 godinu",
|
||||
},
|
||||
dual: "oko {{count}} godine",
|
||||
other: "oko {{count}} godina",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: {
|
||||
standalone: "1 godina",
|
||||
withPrepositionAgo: "1 godine",
|
||||
withPrepositionIn: "1 godinu",
|
||||
},
|
||||
dual: "{{count}} godine",
|
||||
other: "{{count}} godina",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: {
|
||||
standalone: "preko 1 godinu",
|
||||
withPrepositionAgo: "preko 1 godinu",
|
||||
withPrepositionIn: "preko 1 godinu",
|
||||
},
|
||||
dual: "preko {{count}} godine",
|
||||
other: "preko {{count}} godina",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: {
|
||||
standalone: "gotovo 1 godinu",
|
||||
withPrepositionAgo: "gotovo 1 godinu",
|
||||
withPrepositionIn: "gotovo 1 godinu",
|
||||
},
|
||||
dual: "gotovo {{count}} godine",
|
||||
other: "gotovo {{count}} godina",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
result = tokenValue.one.withPrepositionIn;
|
||||
} else {
|
||||
result = tokenValue.one.withPrepositionAgo;
|
||||
}
|
||||
} else {
|
||||
result = tokenValue.one.standalone;
|
||||
}
|
||||
} else if (
|
||||
count % 10 > 1 &&
|
||||
count % 10 < 5 && // if last digit is between 2 and 4
|
||||
String(count).substr(-2, 1) !== "1" // unless the 2nd to last digit is "1"
|
||||
) {
|
||||
result = tokenValue.dual.replace("{{count}}", String(count));
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "za " + result;
|
||||
} else {
|
||||
return "prije " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d. MMMM yyyy.",
|
||||
long: "d. MMMM yyyy.",
|
||||
medium: "d. MMM yy.",
|
||||
short: "dd. MM. yy.",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss (zzzz)",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'u' {{time}}",
|
||||
long: "{{date}} 'u' {{time}}",
|
||||
medium: "{{date}} {{time}}",
|
||||
short: "{{date}} {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: (date) => {
|
||||
switch (date.getDay()) {
|
||||
case 0:
|
||||
return "'prošle nedjelje u' p";
|
||||
case 3:
|
||||
return "'prošle srijede u' p";
|
||||
case 6:
|
||||
return "'prošle subote u' p";
|
||||
default:
|
||||
return "'prošli' EEEE 'u' p";
|
||||
}
|
||||
},
|
||||
yesterday: "'juče u' p",
|
||||
today: "'danas u' p",
|
||||
tomorrow: "'sutra u' p",
|
||||
nextWeek: (date) => {
|
||||
switch (date.getDay()) {
|
||||
case 0:
|
||||
return "'sljedeće nedjelje u' p";
|
||||
case 3:
|
||||
return "'sljedeću srijedu u' p";
|
||||
case 6:
|
||||
return "'sljedeću subotu u' p";
|
||||
default:
|
||||
return "'sljedeći' EEEE 'u' p";
|
||||
}
|
||||
},
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date, _baseDate, _options) => {
|
||||
const format = formatRelativeLocale[token];
|
||||
|
||||
if (typeof format === "function") {
|
||||
return format(date);
|
||||
}
|
||||
|
||||
return format;
|
||||
};
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["pr.n.e.", "AD"],
|
||||
abbreviated: ["pr. Hr.", "po. Hr."],
|
||||
wide: ["Prije Hrista", "Poslije Hrista"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1.", "2.", "3.", "4."],
|
||||
abbreviated: ["1. kv.", "2. kv.", "3. kv.", "4. kv."],
|
||||
wide: ["1. kvartal", "2. kvartal", "3. kvartal", "4. kvartal"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: [
|
||||
"1.",
|
||||
"2.",
|
||||
"3.",
|
||||
"4.",
|
||||
"5.",
|
||||
"6.",
|
||||
"7.",
|
||||
"8.",
|
||||
"9.",
|
||||
"10.",
|
||||
"11.",
|
||||
"12.",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"jan",
|
||||
"feb",
|
||||
"mar",
|
||||
"apr",
|
||||
"maj",
|
||||
"jun",
|
||||
"jul",
|
||||
"avg",
|
||||
"sep",
|
||||
"okt",
|
||||
"nov",
|
||||
"dec",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"januar",
|
||||
"februar",
|
||||
"mart",
|
||||
"april",
|
||||
"maj",
|
||||
"juni",
|
||||
"juli",
|
||||
"avgust",
|
||||
"septembar",
|
||||
"oktobar",
|
||||
"novembar",
|
||||
"decembar",
|
||||
],
|
||||
};
|
||||
|
||||
const formattingMonthValues = {
|
||||
narrow: [
|
||||
"1.",
|
||||
"2.",
|
||||
"3.",
|
||||
"4.",
|
||||
"5.",
|
||||
"6.",
|
||||
"7.",
|
||||
"8.",
|
||||
"9.",
|
||||
"10.",
|
||||
"11.",
|
||||
"12.",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"jan",
|
||||
"feb",
|
||||
"mar",
|
||||
"apr",
|
||||
"maj",
|
||||
"jun",
|
||||
"jul",
|
||||
"avg",
|
||||
"sep",
|
||||
"okt",
|
||||
"nov",
|
||||
"dec",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"januar",
|
||||
"februar",
|
||||
"mart",
|
||||
"april",
|
||||
"maj",
|
||||
"juni",
|
||||
"juli",
|
||||
"avgust",
|
||||
"septembar",
|
||||
"oktobar",
|
||||
"novembar",
|
||||
"decembar",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["N", "P", "U", "S", "Č", "P", "S"],
|
||||
short: ["ned", "pon", "uto", "sre", "čet", "pet", "sub"],
|
||||
abbreviated: ["ned", "pon", "uto", "sre", "čet", "pet", "sub"],
|
||||
wide: [
|
||||
"nedjelja",
|
||||
"ponedjeljak",
|
||||
"utorak",
|
||||
"srijeda",
|
||||
"četvrtak",
|
||||
"petak",
|
||||
"subota",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "popodne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "popodne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
wide: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "poslije podne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "popodne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "popodne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
wide: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "ponoć",
|
||||
noon: "podne",
|
||||
morning: "ujutru",
|
||||
afternoon: "poslije podne",
|
||||
evening: "uveče",
|
||||
night: "noću",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, _options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
return String(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",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
};
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)\./i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(pr\.n\.e\.|AD)/i,
|
||||
abbreviated: /^(pr\.\s?Hr\.|po\.\s?Hr\.)/i,
|
||||
wide: /^(Prije Hrista|prije nove ere|Poslije Hrista|nova era)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^pr/i, /^(po|nova)/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^[1234]\.\s?kv\.?/i,
|
||||
wide: /^[1234]\. kvartal/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^(10|11|12|[123456789])\./i,
|
||||
abbreviated: /^(jan|feb|mar|apr|maj|jun|jul|avg|sep|okt|nov|dec)/i,
|
||||
wide: /^((januar|januara)|(februar|februara)|(mart|marta)|(april|aprila)|(maj|maja)|(juni|juna)|(juli|jula)|(avgust|avgusta)|(septembar|septembra)|(oktobar|oktobra)|(novembar|novembra)|(decembar|decembra))/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^1/i,
|
||||
/^2/i,
|
||||
/^3/i,
|
||||
/^4/i,
|
||||
/^5/i,
|
||||
/^6/i,
|
||||
/^7/i,
|
||||
/^8/i,
|
||||
/^9/i,
|
||||
/^10/i,
|
||||
/^11/i,
|
||||
/^12/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^ja/i,
|
||||
/^f/i,
|
||||
/^mar/i,
|
||||
/^ap/i,
|
||||
/^maj/i,
|
||||
/^jun/i,
|
||||
/^jul/i,
|
||||
/^avg/i,
|
||||
/^s/i,
|
||||
/^o/i,
|
||||
/^n/i,
|
||||
/^d/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[npusčc]/i,
|
||||
short: /^(ned|pon|uto|sre|(čet|cet)|pet|sub)/i,
|
||||
abbreviated: /^(ned|pon|uto|sre|(čet|cet)|pet|sub)/i,
|
||||
wide: /^(nedjelja|ponedjeljak|utorak|srijeda|(četvrtak|cetvrtak)|petak|subota)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
||||
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
any: /^(am|pm|ponoc|ponoć|(po)?podne|uvece|uveče|noću|poslije podne|ujutru)/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^pono/i,
|
||||
noon: /^pod/i,
|
||||
morning: /jutro/i,
|
||||
afternoon: /(poslije\s|po)+podne/i,
|
||||
evening: /(uvece|uveče)/i,
|
||||
night: /(nocu|noću)/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./ca/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ca/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ca/_lib/formatRelative.js";
|
||||
import { localize } from "./ca/_lib/localize.js";
|
||||
import { match } from "./ca/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Catalan locale.
|
||||
* @language Catalan
|
||||
* @iso-639-2 cat
|
||||
* @author Guillermo Grau [@guigrpa](https://github.com/guigrpa)
|
||||
* @author Alex Vizcaino [@avizcaino](https://github.com/avizcaino)
|
||||
*/
|
||||
export const ca = {
|
||||
code: "ca",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 4,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default ca;
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Davant de les xifres que es diuen amb vocal inicial, 1 i 11, s'apostrofen els articles el i la i la preposició de igual que si estiguessin escrits amb lletres.
|
||||
* l'1 de juliol ('l'u')
|
||||
* l'11 de novembre ('l'onze')
|
||||
* l'11a clàusula del contracte ('l'onzena')
|
||||
* la contractació d'11 jugadors ('d'onze')
|
||||
* l'aval d'11.000 socis ('d'onze mil')
|
||||
*
|
||||
* Reference: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?input_cercar=apostrofaci%25F3+davant+xifres&action=Principal&method=detall_completa&numPagina=1&idHit=11236&database=FITXES_PUB&tipusFont=Fitxes%20de%20l%27Optimot&idFont=11236&titol=apostrofaci%F3%20davant%20de%20xifres%20%2F%20apostrofaci%F3%20davant%20de%201%20i%2011&numeroResultat=1&clickLink=detall&tipusCerca=cerca.normes
|
||||
*/
|
||||
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "menys d'un segon",
|
||||
eleven: "menys d'onze segons",
|
||||
other: "menys de {{count}} segons",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 segon",
|
||||
other: "{{count}} segons",
|
||||
},
|
||||
|
||||
halfAMinute: "mig minut",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "menys d'un minut",
|
||||
eleven: "menys d'onze minuts",
|
||||
other: "menys de {{count}} minuts",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "1 minut",
|
||||
other: "{{count}} minuts",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "aproximadament una hora",
|
||||
other: "aproximadament {{count}} hores",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 hora",
|
||||
other: "{{count}} hores",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 dia",
|
||||
other: "{{count}} dies",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "aproximadament una setmana",
|
||||
other: "aproximadament {{count}} setmanes",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 setmana",
|
||||
other: "{{count}} setmanes",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "aproximadament un mes",
|
||||
other: "aproximadament {{count}} mesos",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 mes",
|
||||
other: "{{count}} mesos",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "aproximadament un any",
|
||||
other: "aproximadament {{count}} anys",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 any",
|
||||
other: "{{count}} anys",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "més d'un any",
|
||||
eleven: "més d'onze anys",
|
||||
other: "més de {{count}} anys",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "gairebé un any",
|
||||
other: "gairebé {{count}} anys",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else if (count === 11 && tokenValue.eleven) {
|
||||
result = tokenValue.eleven;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "en " + result;
|
||||
} else {
|
||||
return "fa " + result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d 'de' MMMM y",
|
||||
long: "d 'de' MMMM y",
|
||||
medium: "d MMM y",
|
||||
short: "dd/MM/y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss zzzz",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'a les' {{time}}",
|
||||
long: "{{date}} 'a les' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'el' eeee 'passat a la' LT",
|
||||
yesterday: "'ahir a la' p",
|
||||
today: "'avui a la' p",
|
||||
tomorrow: "'demà a la' p",
|
||||
nextWeek: "eeee 'a la' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
const formatRelativeLocalePlural = {
|
||||
lastWeek: "'el' eeee 'passat a les' p",
|
||||
yesterday: "'ahir a les' p",
|
||||
today: "'avui a les' p",
|
||||
tomorrow: "'demà a les' p",
|
||||
nextWeek: "eeee 'a les' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date, _baseDate, _options) => {
|
||||
if (date.getHours() !== 1) {
|
||||
return formatRelativeLocalePlural[token];
|
||||
}
|
||||
return formatRelativeLocale[token];
|
||||
};
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
/**
|
||||
* General information
|
||||
* Reference: https://aplicacions.llengua.gencat.cat
|
||||
* Reference: https://www.uoc.edu/portal/ca/servei-linguistic/convencions/abreviacions/simbols/simbols-habituals.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abans de Crist: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?input_cercar=abans+de+crist&action=Principal&method=detall_completa&numPagina=1&idHit=6876&database=FITXES_PUB&tipusFont=Fitxes%20de%20l%27Optimot&idFont=6876&titol=abans%20de%20Crist%20(abreviatura)%20/%20abans%20de%20Crist%20(sigla)&numeroResultat=1&clickLink=detall&tipusCerca=cerca.fitxes
|
||||
* Desprest de Crist: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?input_cercar=despr%E9s+de+crist&action=Principal&method=detall_completa&numPagina=1&idHit=6879&database=FITXES_PUB&tipusFont=Fitxes%20de%20l%27Optimot&idFont=6879&titol=despr%E9s%20de%20Crist%20(sigla)%20/%20despr%E9s%20de%20Crist%20(abreviatura)&numeroResultat=1&clickLink=detall&tipusCerca=cerca.fitxes
|
||||
*/
|
||||
const eraValues = {
|
||||
narrow: ["aC", "dC"],
|
||||
abbreviated: ["a. de C.", "d. de C."],
|
||||
wide: ["abans de Crist", "després de Crist"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["T1", "T2", "T3", "T4"],
|
||||
wide: ["1r trimestre", "2n trimestre", "3r trimestre", "4t trimestre"],
|
||||
};
|
||||
|
||||
/**
|
||||
* Dins d'un text convé fer servir la forma sencera dels mesos, ja que sempre és més clar el mot sencer que l'abreviatura, encara que aquesta sigui força coneguda.
|
||||
* Cal reservar, doncs, les abreviatures per a les llistes o classificacions, els gràfics, les taules o quadres estadístics, els textos publicitaris, etc.
|
||||
*
|
||||
* Reference: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?input_cercar=abreviacions+mesos&action=Principal&method=detall_completa&numPagina=1&idHit=8402&database=FITXES_PUB&tipusFont=Fitxes%20de%20l%27Optimot&idFont=8402&titol=abreviatures%20dels%20mesos%20de%20l%27any&numeroResultat=5&clickLink=detall&tipusCerca=cerca.fitxes
|
||||
*/
|
||||
const monthValues = {
|
||||
narrow: [
|
||||
"GN",
|
||||
"FB",
|
||||
"MÇ",
|
||||
"AB",
|
||||
"MG",
|
||||
"JN",
|
||||
"JL",
|
||||
"AG",
|
||||
"ST",
|
||||
"OC",
|
||||
"NV",
|
||||
"DS",
|
||||
],
|
||||
|
||||
/**
|
||||
* Les abreviatures dels mesos de l'any es formen seguint una de les normes generals de formació d'abreviatures.
|
||||
* S'escriu la primera síl·laba i les consonants de la síl·laba següent anteriors a la primera vocal.
|
||||
* Els mesos de març, maig i juny no s'abreugen perquè són paraules d'una sola síl·laba.
|
||||
*/
|
||||
abbreviated: [
|
||||
"gen.",
|
||||
"febr.",
|
||||
"març",
|
||||
"abr.",
|
||||
"maig",
|
||||
"juny",
|
||||
"jul.",
|
||||
"ag.",
|
||||
"set.",
|
||||
"oct.",
|
||||
"nov.",
|
||||
"des.",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"gener",
|
||||
"febrer",
|
||||
"març",
|
||||
"abril",
|
||||
"maig",
|
||||
"juny",
|
||||
"juliol",
|
||||
"agost",
|
||||
"setembre",
|
||||
"octubre",
|
||||
"novembre",
|
||||
"desembre",
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Les abreviatures dels dies de la setmana comencen totes amb la lletra d.
|
||||
* Tot seguit porten la consonant següent a la i, excepte en el cas de dimarts, dimecres i diumenge, en què aquesta consonant és la m i, per tant, hi podria haver confusió.
|
||||
* Per evitar-ho, s'ha substituït la m per una t (en el cas de dimarts), una c (en el cas de dimecres) i una g (en el cas de diumenge), respectivament.
|
||||
*
|
||||
* Seguint la norma general d'ús de les abreviatures, les dels dies de la setmana sempre porten punt final.
|
||||
* Igualment, van amb la primera lletra en majúscula quan la paraula sencera també hi aniria.
|
||||
* En canvi, van amb la primera lletra en minúscula quan la inicial de la paraula sencera també hi aniria.
|
||||
*
|
||||
* Reference: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?input_cercar=abreviatures+dies&action=Principal&method=detall_completa&numPagina=1&idHit=8387&database=FITXES_PUB&tipusFont=Fitxes%20de%20l%27Optimot&idFont=8387&titol=abreviatures%20dels%20dies%20de%20la%20setmana&numeroResultat=1&clickLink=detall&tipusCerca=cerca.tot
|
||||
*/
|
||||
const dayValues = {
|
||||
narrow: ["dg.", "dl.", "dt.", "dm.", "dj.", "dv.", "ds."],
|
||||
short: ["dg.", "dl.", "dt.", "dm.", "dj.", "dv.", "ds."],
|
||||
abbreviated: ["dg.", "dl.", "dt.", "dm.", "dj.", "dv.", "ds."],
|
||||
wide: [
|
||||
"diumenge",
|
||||
"dilluns",
|
||||
"dimarts",
|
||||
"dimecres",
|
||||
"dijous",
|
||||
"divendres",
|
||||
"dissabte",
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Reference: https://aplicacions.llengua.gencat.cat/llc/AppJava/index.html?action=Principal&method=detall&input_cercar=parts+del+dia&numPagina=1&database=FITXES_PUB&idFont=12801&idHit=12801&tipusFont=Fitxes+de+l%27Optimot&numeroResultat=1&databases_avansada=&categories_avansada=&clickLink=detall&titol=Nom+de+les+parts+del+dia&tematica=&tipusCerca=cerca.fitxes
|
||||
*/
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "mitjanit",
|
||||
noon: "migdia",
|
||||
morning: "matí",
|
||||
afternoon: "tarda",
|
||||
evening: "vespre",
|
||||
night: "nit",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "a.m.",
|
||||
pm: "p.m.",
|
||||
midnight: "mitjanit",
|
||||
noon: "migdia",
|
||||
morning: "matí",
|
||||
afternoon: "tarda",
|
||||
evening: "vespre",
|
||||
night: "nit",
|
||||
},
|
||||
wide: {
|
||||
am: "ante meridiem",
|
||||
pm: "post meridiem",
|
||||
midnight: "mitjanit",
|
||||
noon: "migdia",
|
||||
morning: "matí",
|
||||
afternoon: "tarda",
|
||||
evening: "vespre",
|
||||
night: "nit",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "de la mitjanit",
|
||||
noon: "del migdia",
|
||||
morning: "del matí",
|
||||
afternoon: "de la tarda",
|
||||
evening: "del vespre",
|
||||
night: "de la nit",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "de la mitjanit",
|
||||
noon: "del migdia",
|
||||
morning: "del matí",
|
||||
afternoon: "de la tarda",
|
||||
evening: "del vespre",
|
||||
night: "de la nit",
|
||||
},
|
||||
wide: {
|
||||
am: "ante meridiem",
|
||||
pm: "post meridiem",
|
||||
midnight: "de la mitjanit",
|
||||
noon: "del migdia",
|
||||
morning: "del matí",
|
||||
afternoon: "de la tarda",
|
||||
evening: "del vespre",
|
||||
night: "de la nit",
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Quan van en singular, els nombres ordinals es representen, en forma d’abreviatura, amb la xifra seguida de l’última lletra del mot desplegat.
|
||||
* És optatiu posar punt després de la lletra.
|
||||
*
|
||||
* Reference: https://aplicacions.llengua.gencat.cat/llc/AppJava/pdf/abrevia.pdf#page=18
|
||||
*/
|
||||
const ordinalNumber = (dirtyNumber, _options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const rem100 = number % 100;
|
||||
if (rem100 > 20 || rem100 < 10) {
|
||||
switch (rem100 % 10) {
|
||||
case 1:
|
||||
return number + "r";
|
||||
case 2:
|
||||
return number + "n";
|
||||
case 3:
|
||||
return number + "r";
|
||||
case 4:
|
||||
return number + "t";
|
||||
}
|
||||
}
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(è|r|n|r|t)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(aC|dC)/i,
|
||||
abbreviated: /^(a. de C.|d. de C.)/i,
|
||||
wide: /^(abans de Crist|despr[eé]s de Crist)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
narrow: [/^aC/i, /^dC/i],
|
||||
abbreviated: [/^(a. de C.)/i, /^(d. de C.)/i],
|
||||
wide: [/^(abans de Crist)/i, /^(despr[eé]s de Crist)/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^T[1234]/i,
|
||||
wide: /^[1234](è|r|n|r|t)? trimestre/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^(GN|FB|MÇ|AB|MG|JN|JL|AG|ST|OC|NV|DS)/i,
|
||||
abbreviated:
|
||||
/^(gen.|febr.|març|abr.|maig|juny|jul.|ag.|set.|oct.|nov.|des.)/i,
|
||||
wide: /^(gener|febrer|març|abril|maig|juny|juliol|agost|setembre|octubre|novembre|desembre)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^GN/i,
|
||||
/^FB/i,
|
||||
/^MÇ/i,
|
||||
/^AB/i,
|
||||
/^MG/i,
|
||||
/^JN/i,
|
||||
/^JL/i,
|
||||
/^AG/i,
|
||||
/^ST/i,
|
||||
/^OC/i,
|
||||
/^NV/i,
|
||||
/^DS/i,
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
/^gen./i,
|
||||
/^febr./i,
|
||||
/^març/i,
|
||||
/^abr./i,
|
||||
/^maig/i,
|
||||
/^juny/i,
|
||||
/^jul./i,
|
||||
/^ag./i,
|
||||
/^set./i,
|
||||
/^oct./i,
|
||||
/^nov./i,
|
||||
/^des./i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^gener/i,
|
||||
/^febrer/i,
|
||||
/^març/i,
|
||||
/^abril/i,
|
||||
/^maig/i,
|
||||
/^juny/i,
|
||||
/^juliol/i,
|
||||
/^agost/i,
|
||||
/^setembre/i,
|
||||
/^octubre/i,
|
||||
/^novembre/i,
|
||||
/^desembre/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(dg\.|dl\.|dt\.|dm\.|dj\.|dv\.|ds\.)/i,
|
||||
short: /^(dg\.|dl\.|dt\.|dm\.|dj\.|dv\.|ds\.)/i,
|
||||
abbreviated: /^(dg\.|dl\.|dt\.|dm\.|dj\.|dv\.|ds\.)/i,
|
||||
wide: /^(diumenge|dilluns|dimarts|dimecres|dijous|divendres|dissabte)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^dg./i, /^dl./i, /^dt./i, /^dm./i, /^dj./i, /^dv./i, /^ds./i],
|
||||
|
||||
abbreviated: [/^dg./i, /^dl./i, /^dt./i, /^dm./i, /^dj./i, /^dv./i, /^ds./i],
|
||||
|
||||
wide: [
|
||||
/^diumenge/i,
|
||||
/^dilluns/i,
|
||||
/^dimarts/i,
|
||||
/^dimecres/i,
|
||||
/^dijous/i,
|
||||
/^divendres/i,
|
||||
/^disssabte/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|mn|md|(del|de la) (matí|tarda|vespre|nit))/i,
|
||||
abbreviated:
|
||||
/^([ap]\.?\s?m\.?|mitjanit|migdia|(del|de la) (matí|tarda|vespre|nit))/i,
|
||||
wide: /^(ante meridiem|post meridiem|mitjanit|migdia|(del|de la) (matí|tarda|vespre|nit))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^mitjanit/i,
|
||||
noon: /^migdia/i,
|
||||
morning: /matí/i,
|
||||
afternoon: /tarda/i,
|
||||
evening: /vespre/i,
|
||||
night: /nit/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { formatDistance } from "./ckb/_lib/formatDistance.js";
|
||||
import { formatLong } from "./ckb/_lib/formatLong.js";
|
||||
import { formatRelative } from "./ckb/_lib/formatRelative.js";
|
||||
import { localize } from "./ckb/_lib/localize.js";
|
||||
import { match } from "./ckb/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @type {Locale}
|
||||
* @category Locales
|
||||
* @summary Central Kurdish locale.
|
||||
* @language Central Kurdish
|
||||
* @iso-639-2 kur
|
||||
* @author Revan Sarbast [@Revan99]{@link https://github.com/Revan99}
|
||||
*/
|
||||
export const ckb = {
|
||||
code: "ckb",
|
||||
formatDistance,
|
||||
formatLong,
|
||||
formatRelative,
|
||||
localize,
|
||||
match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default ckb;
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "کەمتر لە یەک چرکە",
|
||||
other: "کەمتر لە {{count}} چرکە",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 چرکە",
|
||||
other: "{{count}} چرکە",
|
||||
},
|
||||
|
||||
halfAMinute: "نیو کاتژمێر",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "کەمتر لە یەک خولەک",
|
||||
other: "کەمتر لە {{count}} خولەک",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "1 خولەک",
|
||||
other: "{{count}} خولەک",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "دەوروبەری 1 کاتژمێر",
|
||||
other: "دەوروبەری {{count}} کاتژمێر",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 کاتژمێر",
|
||||
other: "{{count}} کاتژمێر",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 ڕۆژ",
|
||||
other: "{{count}} ژۆژ",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "دەوروبەری 1 هەفتە",
|
||||
other: "دوروبەری {{count}} هەفتە",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 هەفتە",
|
||||
other: "{{count}} هەفتە",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "داوروبەری 1 مانگ",
|
||||
other: "دەوروبەری {{count}} مانگ",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 مانگ",
|
||||
other: "{{count}} مانگ",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "دەوروبەری 1 ساڵ",
|
||||
other: "دەوروبەری {{count}} ساڵ",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 ساڵ",
|
||||
other: "{{count}} ساڵ",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "زیاتر لە ساڵێک",
|
||||
other: "زیاتر لە {{count}} ساڵ",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "بەنزیکەیی ساڵێک ",
|
||||
other: "بەنزیکەیی {{count}} ساڵ",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", count.toString());
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return "لە ماوەی " + result + "دا";
|
||||
} else {
|
||||
return result + "پێش ئێستا";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, MMMM do, y",
|
||||
long: "MMMM do, y",
|
||||
medium: "MMM d, y",
|
||||
short: "MM/dd/yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "h:mm:ss a zzzz",
|
||||
long: "h:mm:ss a z",
|
||||
medium: "h:mm:ss a",
|
||||
short: "h:mm a",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'کاتژمێر' {{time}}",
|
||||
long: "{{date}} 'کاتژمێر' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'هەفتەی ڕابردوو' eeee 'کاتژمێر' p",
|
||||
yesterday: "'دوێنێ کاتژمێر' p",
|
||||
today: "'ئەمڕۆ کاتژمێر' p",
|
||||
tomorrow: "'بەیانی کاتژمێر' p",
|
||||
nextWeek: "eeee 'کاتژمێر' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["پ", "د"],
|
||||
abbreviated: ["پ-ز", "د-ز"],
|
||||
wide: ["پێش زاین", "دوای زاین"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["چ1م", "چ2م", "چ3م", "چ4م"],
|
||||
wide: ["چارەگی یەکەم", "چارەگی دووەم", "چارەگی سێیەم", "چارەگی چوارەم"],
|
||||
};
|
||||
|
||||
// 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: [
|
||||
"ک-د",
|
||||
"ش",
|
||||
"ئا",
|
||||
"ن",
|
||||
"م",
|
||||
"ح",
|
||||
"ت",
|
||||
"ئا",
|
||||
"ئە",
|
||||
"تش-ی",
|
||||
"تش-د",
|
||||
"ک-ی",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"کان-دوو",
|
||||
"شوب",
|
||||
"ئاد",
|
||||
"نیس",
|
||||
"مایس",
|
||||
"حوز",
|
||||
"تەم",
|
||||
"ئاب",
|
||||
"ئەل",
|
||||
"تش-یەک",
|
||||
"تش-دوو",
|
||||
"کان-یەک",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"کانوونی دووەم",
|
||||
"شوبات",
|
||||
"ئادار",
|
||||
"نیسان",
|
||||
"مایس",
|
||||
"حوزەیران",
|
||||
"تەمموز",
|
||||
"ئاب",
|
||||
"ئەیلول",
|
||||
"تشرینی یەکەم",
|
||||
"تشرینی دووەم",
|
||||
"کانوونی یەکەم",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ی-ش", "د-ش", "س-ش", "چ-ش", "پ-ش", "هە", "ش"],
|
||||
short: ["یە-شە", "دوو-شە", "سێ-شە", "چو-شە", "پێ-شە", "هەی", "شە"],
|
||||
abbreviated: [
|
||||
"یەک-شەم",
|
||||
"دوو-شەم",
|
||||
"سێ-شەم",
|
||||
"چوار-شەم",
|
||||
"پێنج-شەم",
|
||||
"هەینی",
|
||||
"شەمە",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"یەک شەمە",
|
||||
"دوو شەمە",
|
||||
"سێ شەمە",
|
||||
"چوار شەمە",
|
||||
"پێنج شەمە",
|
||||
"هەینی",
|
||||
"شەمە",
|
||||
],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "پ",
|
||||
pm: "د",
|
||||
midnight: "ن-ش",
|
||||
noon: "ن",
|
||||
morning: "بەیانی",
|
||||
afternoon: "دوای نیوەڕۆ",
|
||||
evening: "ئێوارە",
|
||||
night: "شەو",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "پ-ن",
|
||||
pm: "د-ن",
|
||||
midnight: "نیوە شەو",
|
||||
noon: "نیوەڕۆ",
|
||||
morning: "بەیانی",
|
||||
afternoon: "دوای نیوەڕۆ",
|
||||
evening: "ئێوارە",
|
||||
night: "شەو",
|
||||
},
|
||||
wide: {
|
||||
am: "پێش نیوەڕۆ",
|
||||
pm: "دوای نیوەڕۆ",
|
||||
midnight: "نیوە شەو",
|
||||
noon: "نیوەڕۆ",
|
||||
morning: "بەیانی",
|
||||
afternoon: "دوای نیوەڕۆ",
|
||||
evening: "ئێوارە",
|
||||
night: "شەو",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "پ",
|
||||
pm: "د",
|
||||
midnight: "ن-ش",
|
||||
noon: "ن",
|
||||
morning: "لە بەیانیدا",
|
||||
afternoon: "لە دوای نیوەڕۆدا",
|
||||
evening: "لە ئێوارەدا",
|
||||
night: "لە شەودا",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "پ-ن",
|
||||
pm: "د-ن",
|
||||
midnight: "نیوە شەو",
|
||||
noon: "نیوەڕۆ",
|
||||
morning: "لە بەیانیدا",
|
||||
afternoon: "لە دوای نیوەڕۆدا",
|
||||
evening: "لە ئێوارەدا",
|
||||
night: "لە شەودا",
|
||||
},
|
||||
wide: {
|
||||
am: "پێش نیوەڕۆ",
|
||||
pm: "دوای نیوەڕۆ",
|
||||
midnight: "نیوە شەو",
|
||||
noon: "نیوەڕۆ",
|
||||
morning: "لە بەیانیدا",
|
||||
afternoon: "لە دوای نیوەڕۆدا",
|
||||
evening: "لە ئێوارەدا",
|
||||
night: "لە شەودا",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, _options) => {
|
||||
return String(dirtyNumber);
|
||||
};
|
||||
|
||||
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",
|
||||
}),
|
||||
};
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(پ|د)/i,
|
||||
abbreviated: /^(پ-ز|د.ز)/i,
|
||||
wide: /^(پێش زاین| دوای زاین)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^د/g, /^پ/g],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^م[1234]چ/i,
|
||||
wide: /^(یەکەم|دووەم|سێیەم| چوارەم) (چارەگی)? quarter/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
wide: [/چارەگی یەکەم/, /چارەگی دووەم/, /چارەگی سيیەم/, /چارەگی چوارەم/],
|
||||
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^(ک-د|ش|ئا|ن|م|ح|ت|ئە|تش-ی|تش-د|ک-ی)/i,
|
||||
abbreviated:
|
||||
/^(کان-دوو|شوب|ئاد|نیس|مایس|حوز|تەم|ئاب|ئەل|تش-یەک|تش-دوو|کان-یەک)/i,
|
||||
wide: /^(کانوونی دووەم|شوبات|ئادار|نیسان|مایس|حوزەیران|تەمموز|ئاب|ئەیلول|تشرینی یەکەم|تشرینی دووەم|کانوونی یەکەم)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^ک-د/i,
|
||||
/^ش/i,
|
||||
/^ئا/i,
|
||||
/^ن/i,
|
||||
/^م/i,
|
||||
/^ح/i,
|
||||
/^ت/i,
|
||||
/^ئا/i,
|
||||
/^ئە/i,
|
||||
/^تش-ی/i,
|
||||
/^تش-د/i,
|
||||
/^ک-ی/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^کان-دوو/i,
|
||||
/^شوب/i,
|
||||
/^ئاد/i,
|
||||
/^نیس/i,
|
||||
/^مایس/i,
|
||||
/^حوز/i,
|
||||
/^تەم/i,
|
||||
/^ئاب/i,
|
||||
/^ئەل/i,
|
||||
/^تش-یەک/i,
|
||||
/^تش-دوو/i,
|
||||
/^|کان-یەک/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(ش|ی|د|س|چ|پ|هە)/i,
|
||||
short: /^(یە-شە|دوو-شە|سێ-شە|چو-شە|پێ-شە|هە|شە)/i,
|
||||
abbreviated: /^(یەک-شەم|دوو-شەم|سێ-شەم|چوار-شەم|پێنخ-شەم|هەینی|شەمە)/i,
|
||||
wide: /^(یەک شەمە|دوو شەمە|سێ شەمە|چوار شەمە|پێنج شەمە|هەینی|شەمە)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
||||
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(پ|د|ن-ش|ن| (بەیانی|دوای نیوەڕۆ|ئێوارە|شەو))/i,
|
||||
abbreviated: /^(پ-ن|د-ن|نیوە شەو|نیوەڕۆ|بەیانی|دوای نیوەڕۆ|ئێوارە|شەو)/,
|
||||
wide: /^(پێش نیوەڕۆ|دوای نیوەڕۆ|نیوەڕۆ|نیوە شەو|لەبەیانیدا|لەدواینیوەڕۆدا|لە ئێوارەدا|لە شەودا)/,
|
||||
any: /^(پ|د|بەیانی|نیوەڕۆ|ئێوارە|شەو)/,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^د/i,
|
||||
pm: /^پ/i,
|
||||
midnight: /^ن-ش/i,
|
||||
noon: /^ن/i,
|
||||
morning: /بەیانی/i,
|
||||
afternoon: /دواینیوەڕۆ/i,
|
||||
evening: /ئێوارە/i,
|
||||
night: /شەو/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { formatDistance } from "./cs/_lib/formatDistance.js";
|
||||
import { formatLong } from "./cs/_lib/formatLong.js";
|
||||
import { formatRelative } from "./cs/_lib/formatRelative.js";
|
||||
import { localize } from "./cs/_lib/localize.js";
|
||||
import { match } from "./cs/_lib/match.js";
|
||||
|
||||
/**
|
||||
* @category Locales
|
||||
* @summary Czech locale.
|
||||
* @language Czech
|
||||
* @iso-639-2 ces
|
||||
* @author David Rus [@davidrus](https://github.com/davidrus)
|
||||
* @author Pavel Hrách [@SilenY](https://github.com/SilenY)
|
||||
* @author Jozef Bíroš [@JozefBiros](https://github.com/JozefBiros)
|
||||
*/
|
||||
export const cs = {
|
||||
code: "cs",
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 1 /* Monday */,
|
||||
firstWeekContainsDate: 4,
|
||||
},
|
||||
};
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default cs;
|
||||
+320
@@ -0,0 +1,320 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: {
|
||||
regular: "méně než 1 sekunda",
|
||||
past: "před méně než 1 sekundou",
|
||||
future: "za méně než 1 sekundu",
|
||||
},
|
||||
few: {
|
||||
regular: "méně než {{count}} sekundy",
|
||||
past: "před méně než {{count}} sekundami",
|
||||
future: "za méně než {{count}} sekundy",
|
||||
},
|
||||
many: {
|
||||
regular: "méně než {{count}} sekund",
|
||||
past: "před méně než {{count}} sekundami",
|
||||
future: "za méně než {{count}} sekund",
|
||||
},
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: {
|
||||
regular: "1 sekunda",
|
||||
past: "před 1 sekundou",
|
||||
future: "za 1 sekundu",
|
||||
},
|
||||
few: {
|
||||
regular: "{{count}} sekundy",
|
||||
past: "před {{count}} sekundami",
|
||||
future: "za {{count}} sekundy",
|
||||
},
|
||||
many: {
|
||||
regular: "{{count}} sekund",
|
||||
past: "před {{count}} sekundami",
|
||||
future: "za {{count}} sekund",
|
||||
},
|
||||
},
|
||||
|
||||
halfAMinute: {
|
||||
type: "other",
|
||||
other: {
|
||||
regular: "půl minuty",
|
||||
past: "před půl minutou",
|
||||
future: "za půl minuty",
|
||||
},
|
||||
},
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: {
|
||||
regular: "méně než 1 minuta",
|
||||
past: "před méně než 1 minutou",
|
||||
future: "za méně než 1 minutu",
|
||||
},
|
||||
few: {
|
||||
regular: "méně než {{count}} minuty",
|
||||
past: "před méně než {{count}} minutami",
|
||||
future: "za méně než {{count}} minuty",
|
||||
},
|
||||
many: {
|
||||
regular: "méně než {{count}} minut",
|
||||
past: "před méně než {{count}} minutami",
|
||||
future: "za méně než {{count}} minut",
|
||||
},
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: {
|
||||
regular: "1 minuta",
|
||||
past: "před 1 minutou",
|
||||
future: "za 1 minutu",
|
||||
},
|
||||
few: {
|
||||
regular: "{{count}} minuty",
|
||||
past: "před {{count}} minutami",
|
||||
future: "za {{count}} minuty",
|
||||
},
|
||||
many: {
|
||||
regular: "{{count}} minut",
|
||||
past: "před {{count}} minutami",
|
||||
future: "za {{count}} minut",
|
||||
},
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: {
|
||||
regular: "přibližně 1 hodina",
|
||||
past: "přibližně před 1 hodinou",
|
||||
future: "přibližně za 1 hodinu",
|
||||
},
|
||||
few: {
|
||||
regular: "přibližně {{count}} hodiny",
|
||||
past: "přibližně před {{count}} hodinami",
|
||||
future: "přibližně za {{count}} hodiny",
|
||||
},
|
||||
many: {
|
||||
regular: "přibližně {{count}} hodin",
|
||||
past: "přibližně před {{count}} hodinami",
|
||||
future: "přibližně za {{count}} hodin",
|
||||
},
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: {
|
||||
regular: "1 hodina",
|
||||
past: "před 1 hodinou",
|
||||
future: "za 1 hodinu",
|
||||
},
|
||||
few: {
|
||||
regular: "{{count}} hodiny",
|
||||
past: "před {{count}} hodinami",
|
||||
future: "za {{count}} hodiny",
|
||||
},
|
||||
many: {
|
||||
regular: "{{count}} hodin",
|
||||
past: "před {{count}} hodinami",
|
||||
future: "za {{count}} hodin",
|
||||
},
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: {
|
||||
regular: "1 den",
|
||||
past: "před 1 dnem",
|
||||
future: "za 1 den",
|
||||
},
|
||||
few: {
|
||||
regular: "{{count}} dny",
|
||||
past: "před {{count}} dny",
|
||||
future: "za {{count}} dny",
|
||||
},
|
||||
many: {
|
||||
regular: "{{count}} dní",
|
||||
past: "před {{count}} dny",
|
||||
future: "za {{count}} dní",
|
||||
},
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: {
|
||||
regular: "přibližně 1 týden",
|
||||
past: "přibližně před 1 týdnem",
|
||||
future: "přibližně za 1 týden",
|
||||
},
|
||||
|
||||
few: {
|
||||
regular: "přibližně {{count}} týdny",
|
||||
past: "přibližně před {{count}} týdny",
|
||||
future: "přibližně za {{count}} týdny",
|
||||
},
|
||||
|
||||
many: {
|
||||
regular: "přibližně {{count}} týdnů",
|
||||
past: "přibližně před {{count}} týdny",
|
||||
future: "přibližně za {{count}} týdnů",
|
||||
},
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: {
|
||||
regular: "1 týden",
|
||||
past: "před 1 týdnem",
|
||||
future: "za 1 týden",
|
||||
},
|
||||
|
||||
few: {
|
||||
regular: "{{count}} týdny",
|
||||
past: "před {{count}} týdny",
|
||||
future: "za {{count}} týdny",
|
||||
},
|
||||
|
||||
many: {
|
||||
regular: "{{count}} týdnů",
|
||||
past: "před {{count}} týdny",
|
||||
future: "za {{count}} týdnů",
|
||||
},
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: {
|
||||
regular: "přibližně 1 měsíc",
|
||||
past: "přibližně před 1 měsícem",
|
||||
future: "přibližně za 1 měsíc",
|
||||
},
|
||||
|
||||
few: {
|
||||
regular: "přibližně {{count}} měsíce",
|
||||
past: "přibližně před {{count}} měsíci",
|
||||
future: "přibližně za {{count}} měsíce",
|
||||
},
|
||||
|
||||
many: {
|
||||
regular: "přibližně {{count}} měsíců",
|
||||
past: "přibližně před {{count}} měsíci",
|
||||
future: "přibližně za {{count}} měsíců",
|
||||
},
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: {
|
||||
regular: "1 měsíc",
|
||||
past: "před 1 měsícem",
|
||||
future: "za 1 měsíc",
|
||||
},
|
||||
|
||||
few: {
|
||||
regular: "{{count}} měsíce",
|
||||
past: "před {{count}} měsíci",
|
||||
future: "za {{count}} měsíce",
|
||||
},
|
||||
|
||||
many: {
|
||||
regular: "{{count}} měsíců",
|
||||
past: "před {{count}} měsíci",
|
||||
future: "za {{count}} měsíců",
|
||||
},
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: {
|
||||
regular: "přibližně 1 rok",
|
||||
past: "přibližně před 1 rokem",
|
||||
future: "přibližně za 1 rok",
|
||||
},
|
||||
few: {
|
||||
regular: "přibližně {{count}} roky",
|
||||
past: "přibližně před {{count}} roky",
|
||||
future: "přibližně za {{count}} roky",
|
||||
},
|
||||
many: {
|
||||
regular: "přibližně {{count}} roků",
|
||||
past: "přibližně před {{count}} roky",
|
||||
future: "přibližně za {{count}} roků",
|
||||
},
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: {
|
||||
regular: "1 rok",
|
||||
past: "před 1 rokem",
|
||||
future: "za 1 rok",
|
||||
},
|
||||
few: {
|
||||
regular: "{{count}} roky",
|
||||
past: "před {{count}} roky",
|
||||
future: "za {{count}} roky",
|
||||
},
|
||||
many: {
|
||||
regular: "{{count}} roků",
|
||||
past: "před {{count}} roky",
|
||||
future: "za {{count}} roků",
|
||||
},
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: {
|
||||
regular: "více než 1 rok",
|
||||
past: "před více než 1 rokem",
|
||||
future: "za více než 1 rok",
|
||||
},
|
||||
few: {
|
||||
regular: "více než {{count}} roky",
|
||||
past: "před více než {{count}} roky",
|
||||
future: "za více než {{count}} roky",
|
||||
},
|
||||
many: {
|
||||
regular: "více než {{count}} roků",
|
||||
past: "před více než {{count}} roky",
|
||||
future: "za více než {{count}} roků",
|
||||
},
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: {
|
||||
regular: "skoro 1 rok",
|
||||
past: "skoro před 1 rokem",
|
||||
future: "skoro za 1 rok",
|
||||
},
|
||||
few: {
|
||||
regular: "skoro {{count}} roky",
|
||||
past: "skoro před {{count}} roky",
|
||||
future: "skoro za {{count}} roky",
|
||||
},
|
||||
many: {
|
||||
regular: "skoro {{count}} roků",
|
||||
past: "skoro před {{count}} roky",
|
||||
future: "skoro za {{count}} roků",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let pluralResult;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
|
||||
// cs pluralization
|
||||
if (tokenValue.type === "other") {
|
||||
pluralResult = tokenValue.other;
|
||||
} else if (count === 1) {
|
||||
pluralResult = tokenValue.one;
|
||||
} else if (count > 1 && count < 5) {
|
||||
pluralResult = tokenValue.few;
|
||||
} else {
|
||||
pluralResult = tokenValue.many;
|
||||
}
|
||||
|
||||
// times
|
||||
const suffixExist = options?.addSuffix === true;
|
||||
const comparison = options?.comparison;
|
||||
|
||||
let timeResult;
|
||||
if (suffixExist && comparison === -1) {
|
||||
timeResult = pluralResult.past;
|
||||
} else if (suffixExist && comparison === 1) {
|
||||
timeResult = pluralResult.future;
|
||||
} else {
|
||||
timeResult = pluralResult.regular;
|
||||
}
|
||||
|
||||
return timeResult.replace("{{count}}", String(count));
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.js";
|
||||
|
||||
const dateFormats = {
|
||||
full: "EEEE, d. MMMM yyyy",
|
||||
long: "d. MMMM yyyy",
|
||||
medium: "d. M. yyyy",
|
||||
short: "dd.MM.yyyy",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "H:mm:ss zzzz",
|
||||
long: "H:mm:ss z",
|
||||
medium: "H:mm:ss",
|
||||
short: "H:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
full: "{{date}} 'v' {{time}}",
|
||||
long: "{{date}} 'v' {{time}}",
|
||||
medium: "{{date}}, {{time}}",
|
||||
short: "{{date}}, {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
const accusativeWeekdays = [
|
||||
"neděli",
|
||||
"pondělí",
|
||||
"úterý",
|
||||
"středu",
|
||||
"čtvrtek",
|
||||
"pátek",
|
||||
"sobotu",
|
||||
];
|
||||
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "'poslední' eeee 've' p",
|
||||
yesterday: "'včera v' p",
|
||||
today: "'dnes v' p",
|
||||
tomorrow: "'zítra v' p",
|
||||
nextWeek: (date) => {
|
||||
const day = date.getDay();
|
||||
return "'v " + accusativeWeekdays[day] + " o' p";
|
||||
},
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, date) => {
|
||||
const format = formatRelativeLocale[token];
|
||||
|
||||
if (typeof format === "function") {
|
||||
return format(date);
|
||||
}
|
||||
|
||||
return format;
|
||||
};
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.js";
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["př. n. l.", "n. l."],
|
||||
abbreviated: ["př. n. l.", "n. l."],
|
||||
wide: ["před naším letopočtem", "našeho letopočtu"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["1. čtvrtletí", "2. čtvrtletí", "3. čtvrtletí", "4. čtvrtletí"],
|
||||
|
||||
wide: ["1. čtvrtletí", "2. čtvrtletí", "3. čtvrtletí", "4. čtvrtletí"],
|
||||
};
|
||||
|
||||
const monthValues = {
|
||||
narrow: ["L", "Ú", "B", "D", "K", "Č", "Č", "S", "Z", "Ř", "L", "P"],
|
||||
abbreviated: [
|
||||
"led",
|
||||
"úno",
|
||||
"bře",
|
||||
"dub",
|
||||
"kvě",
|
||||
"čvn",
|
||||
"čvc",
|
||||
"srp",
|
||||
"zář",
|
||||
"říj",
|
||||
"lis",
|
||||
"pro",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"leden",
|
||||
"únor",
|
||||
"březen",
|
||||
"duben",
|
||||
"květen",
|
||||
"červen",
|
||||
"červenec",
|
||||
"srpen",
|
||||
"září",
|
||||
"říjen",
|
||||
"listopad",
|
||||
"prosinec",
|
||||
],
|
||||
};
|
||||
|
||||
const formattingMonthValues = {
|
||||
narrow: ["L", "Ú", "B", "D", "K", "Č", "Č", "S", "Z", "Ř", "L", "P"],
|
||||
abbreviated: [
|
||||
"led",
|
||||
"úno",
|
||||
"bře",
|
||||
"dub",
|
||||
"kvě",
|
||||
"čvn",
|
||||
"čvc",
|
||||
"srp",
|
||||
"zář",
|
||||
"říj",
|
||||
"lis",
|
||||
"pro",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"ledna",
|
||||
"února",
|
||||
"března",
|
||||
"dubna",
|
||||
"května",
|
||||
"června",
|
||||
"července",
|
||||
"srpna",
|
||||
"září",
|
||||
"října",
|
||||
"listopadu",
|
||||
"prosince",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["ne", "po", "út", "st", "čt", "pá", "so"],
|
||||
short: ["ne", "po", "út", "st", "čt", "pá", "so"],
|
||||
abbreviated: ["ned", "pon", "úte", "stř", "čtv", "pát", "sob"],
|
||||
wide: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"],
|
||||
};
|
||||
|
||||
const dayPeriodValues = {
|
||||
narrow: {
|
||||
am: "dop.",
|
||||
pm: "odp.",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "dop.",
|
||||
pm: "odp.",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
wide: {
|
||||
am: "dopoledne",
|
||||
pm: "odpoledne",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "dop.",
|
||||
pm: "odp.",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "dop.",
|
||||
pm: "odp.",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
wide: {
|
||||
am: "dopoledne",
|
||||
pm: "odpoledne",
|
||||
midnight: "půlnoc",
|
||||
noon: "poledne",
|
||||
morning: "ráno",
|
||||
afternoon: "odpoledne",
|
||||
evening: "večer",
|
||||
night: "noc",
|
||||
},
|
||||
};
|
||||
|
||||
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",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
};
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.js";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.js";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)\.?/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,
|
||||
abbreviated: /^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,
|
||||
wide: /^(p[řr](\.|ed) Kristem|p[řr](\.|ed) na[šs][íi]m letopo[čc]tem|po Kristu|na[šs]eho letopo[čc]tu)/i,
|
||||
};
|
||||
|
||||
const parseEraPatterns = {
|
||||
any: [/^p[řr]/i, /^(po|n)/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^[1234]\. [čc]tvrtlet[íi]/i,
|
||||
wide: /^[1234]\. [čc]tvrtlet[íi]/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
narrow: /^[lúubdkčcszřrlp]/i,
|
||||
abbreviated:
|
||||
/^(led|[úu]no|b[řr]e|dub|kv[ěe]|[čc]vn|[čc]vc|srp|z[áa][řr]|[řr][íi]j|lis|pro)/i,
|
||||
wide: /^(leden|ledna|[úu]nora?|b[řr]ezen|b[řr]ezna|duben|dubna|kv[ěe]ten|kv[ěe]tna|[čc]erven(ec|ce)?|[čc]ervna|srpen|srpna|z[áa][řr][íi]|[řr][íi]jen|[řr][íi]jna|listopad(a|u)?|prosinec|prosince)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/^l/i,
|
||||
/^[úu]/i,
|
||||
/^b/i,
|
||||
/^d/i,
|
||||
/^k/i,
|
||||
/^[čc]/i,
|
||||
/^[čc]/i,
|
||||
/^s/i,
|
||||
/^z/i,
|
||||
/^[řr]/i,
|
||||
/^l/i,
|
||||
/^p/i,
|
||||
],
|
||||
|
||||
any: [
|
||||
/^led/i,
|
||||
/^[úu]n/i,
|
||||
/^b[řr]e/i,
|
||||
/^dub/i,
|
||||
/^kv[ěe]/i,
|
||||
/^[čc]vn|[čc]erven(?!\w)|[čc]ervna/i,
|
||||
/^[čc]vc|[čc]erven(ec|ce)/i,
|
||||
/^srp/i,
|
||||
/^z[áa][řr]/i,
|
||||
/^[řr][íi]j/i,
|
||||
/^lis/i,
|
||||
/^pro/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^[npuúsčps]/i,
|
||||
short: /^(ne|po|[úu]t|st|[čc]t|p[áa]|so)/i,
|
||||
abbreviated: /^(ned|pon|[úu]te|st[rř]|[čc]tv|p[áa]t|sob)/i,
|
||||
wide: /^(ned[ěe]le|pond[ěe]l[íi]|[úu]ter[ýy]|st[řr]eda|[čc]tvrtek|p[áa]tek|sobota)/i,
|
||||
};
|
||||
|
||||
const parseDayPatterns = {
|
||||
narrow: [/^n/i, /^p/i, /^[úu]/i, /^s/i, /^[čc]/i, /^p/i, /^s/i],
|
||||
any: [/^ne/i, /^po/i, /^[úu]t/i, /^st/i, /^[čc]t/i, /^p[áa]/i, /^so/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
any: /^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^dop/i,
|
||||
pm: /^odp/i,
|
||||
midnight: /^p[ůu]lnoc/i,
|
||||
noon: /^poledne/i,
|
||||
morning: /r[áa]no/i,
|
||||
afternoon: /odpoledne/i,
|
||||
evening: /ve[čc]er/i,
|
||||
night: /noc/i,
|
||||
},
|
||||
};
|
||||
|
||||
export const match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "any",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user