-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Northern Sámi (`se`) locale.
- Loading branch information
Showing
9 changed files
with
1,001 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import type { FormatDistanceFn, FormatDistanceLocale } from "../../../types.js"; | ||
|
||
type FormatDistanceTokenValue = | ||
| string | ||
| { | ||
one: string; | ||
other: string; | ||
}; | ||
|
||
const formatDistanceLocale: FormatDistanceLocale<FormatDistanceTokenValue> = { | ||
lessThanXSeconds: { | ||
one: "unnit go ovtta sekundda", | ||
other: "unnit go {{count}} sekundda", | ||
}, | ||
|
||
xSeconds: { | ||
one: "sekundda", | ||
other: "{{count}} sekundda", | ||
}, | ||
|
||
halfAMinute: "bealle minuhta", | ||
|
||
lessThanXMinutes: { | ||
one: "unnit go bealle minuhta", | ||
other: "unnit go {{count}} minuhta", | ||
}, | ||
|
||
xMinutes: { | ||
one: "minuhta", | ||
other: "{{count}} minuhta", | ||
}, | ||
|
||
aboutXHours: { | ||
one: "sullii ovtta diimmu", | ||
other: "sullii {{count}} diimmu", | ||
}, | ||
|
||
xHours: { | ||
one: "diimmu", | ||
other: "{{count}} diimmu", | ||
}, | ||
|
||
xDays: { | ||
one: "beaivvi", | ||
other: "{{count}} beaivvi", | ||
}, | ||
|
||
aboutXWeeks: { | ||
one: "sullii ovtta vahku", | ||
other: "sullii {{count}} vahku", | ||
}, | ||
|
||
xWeeks: { | ||
one: "vahku", | ||
other: "{{count}} vahku", | ||
}, | ||
|
||
aboutXMonths: { | ||
one: "sullii ovtta mánu", | ||
other: "sullii {{count}} mánu", | ||
}, | ||
|
||
xMonths: { | ||
one: "mánu", | ||
other: "{{count}} mánu", | ||
}, | ||
|
||
aboutXYears: { | ||
one: "sullii ovtta jagi", | ||
other: "sullii {{count}} jagi", | ||
}, | ||
|
||
xYears: { | ||
one: "jagi", | ||
other: "{{count}} jagi", | ||
}, | ||
|
||
overXYears: { | ||
one: "guhkit go jagi", | ||
other: "guhkit go {{count}} jagi", | ||
}, | ||
|
||
almostXYears: { | ||
one: "measta jagi", | ||
other: "measta {{count}} jagi", | ||
}, | ||
}; | ||
|
||
export const formatDistance: FormatDistanceFn = (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 "geahčen " + result; | ||
} else { | ||
return result + " áigi"; | ||
} | ||
} | ||
|
||
return result; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { FormatLong } from "../../../types.js"; | ||
import { buildFormatLongFn } from "../../../_lib/buildFormatLongFn/index.js"; | ||
|
||
const dateFormats = { | ||
full: "EEEE MMMM d. 'b.' y", | ||
long: "MMMM d. 'b.' y", | ||
medium: "MMM d. 'b.' y", | ||
short: "dd.MM.y", | ||
}; | ||
|
||
const timeFormats = { | ||
full: "'dii.' HH:mm:ss zzzz", | ||
long: "HH:mm:ss z", | ||
medium: "HH:mm:ss", | ||
short: "HH:mm", | ||
}; | ||
|
||
const dateTimeFormats = { | ||
full: "{{date}} 'dii.' {{time}}", | ||
long: "{{date}} 'dii.' {{time}}", | ||
medium: "{{date}} {{time}}", | ||
short: "{{date}} {{time}}", | ||
}; | ||
|
||
export const formatLong: FormatLong = { | ||
date: buildFormatLongFn({ | ||
formats: dateFormats, | ||
defaultWidth: "full", | ||
}), | ||
|
||
time: buildFormatLongFn({ | ||
formats: timeFormats, | ||
defaultWidth: "full", | ||
}), | ||
|
||
dateTime: buildFormatLongFn({ | ||
formats: dateTimeFormats, | ||
defaultWidth: "full", | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { FormatRelativeFn } from "../../../types.js"; | ||
|
||
const formatRelativeLocale = { | ||
lastWeek: "'ovddit' eeee 'dii.' p", | ||
yesterday: "'ikte dii.' p", | ||
today: "'odne dii.' p", | ||
tomorrow: "'ihtin dii.' p", | ||
nextWeek: "EEEE 'dii.' p", | ||
other: "P", | ||
}; | ||
|
||
export const formatRelative: FormatRelativeFn = ( | ||
token, | ||
_date, | ||
_baseDate, | ||
_options, | ||
) => formatRelativeLocale[token]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import type { Localize, LocalizeFn } from "../../../types.js"; | ||
import { buildLocalizeFn } from "../../../_lib/buildLocalizeFn/index.js"; | ||
|
||
const eraValues = { | ||
narrow: ["o.Kr.", "m.Kr."] as const, | ||
abbreviated: ["o.Kr.", "m.Kr."] as const, | ||
wide: ["ovdal Kristusa", "maŋŋel Kristusa"] as const, | ||
}; | ||
|
||
const quarterValues = { | ||
narrow: ["1", "2", "3", "4"] as const, | ||
abbreviated: ["Q1", "Q2", "Q3", "Q4"] as const, | ||
wide: ["1. kvartála", "2. kvartála", "3. kvartála", "4. kvartála"] as const, | ||
}; | ||
|
||
const monthValues = { | ||
narrow: ["O", "G", "N", "C", "M", "G", "S", "B", "Č", "G", "S", "J"] as const, | ||
abbreviated: [ | ||
"ođđa", | ||
"guov", | ||
"njuk", | ||
"cuo", | ||
"mies", | ||
"geas", | ||
"suoi", | ||
"borg", | ||
"čakč", | ||
"golg", | ||
"skáb", | ||
"juov", | ||
] as const, | ||
wide: [ | ||
"ođđajagemánnu", | ||
"guovvamánnu", | ||
"njukčamánnu", | ||
"cuoŋománnu", | ||
"miessemánnu", | ||
"geassemánnu", | ||
"suoidnemánnu", | ||
"borgemánnu", | ||
"čakčamánnu", | ||
"golggotmánnu", | ||
"skábmamánnu", | ||
"juovlamánnu", | ||
] as const, | ||
}; | ||
|
||
const dayValues = { | ||
narrow: ["S", "V", "M", "G", "D", "B", "L"] as const, | ||
short: ["sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"] as const, | ||
abbreviated: ["sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"] as const, | ||
wide: [ | ||
"sotnabeaivi", | ||
"vuossárga", | ||
"maŋŋebárga", | ||
"gaskavahkku", | ||
"duorastat", | ||
"bearjadat", | ||
"lávvardat", | ||
] as const, | ||
}; | ||
|
||
const dayPeriodValues = { | ||
narrow: { | ||
am: "a", | ||
pm: "p", | ||
midnight: "gaskaidja", | ||
noon: "gaskabeaivi", | ||
morning: "iđđes", | ||
afternoon: "maŋŋel gaska.", | ||
evening: "eahkes", | ||
night: "ihkku", | ||
}, | ||
abbreviated: { | ||
am: "a.m.", | ||
pm: "p.m.", | ||
midnight: "gaskaidja", | ||
noon: "gaskabeaivvi", | ||
morning: "iđđes", | ||
afternoon: "maŋŋel gaskabea.", | ||
evening: "eahkes", | ||
night: "ihkku", | ||
}, | ||
wide: { | ||
am: "a.m.", | ||
pm: "p.m.", | ||
midnight: "gaskaidja", | ||
noon: "gaskabeavvi", | ||
morning: "iđđes", | ||
afternoon: "maŋŋel gaskabeaivvi", | ||
evening: "eahkes", | ||
night: "ihkku", | ||
}, | ||
}; | ||
|
||
const ordinalNumber: LocalizeFn<number> = (dirtyNumber, _options) => { | ||
const number = Number(dirtyNumber); | ||
return number + "."; | ||
}; | ||
|
||
export const localize: 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", | ||
}), | ||
}; |
Oops, something went wrong.