Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Haitian Creole (`ht`) locale.
- Loading branch information
Showing
13 changed files
with
868 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
var formatDistanceLocale = { | ||
lessThanXSeconds: { | ||
one: 'mwens pase yon segond', | ||
other: 'mwens pase {{count}} segond', | ||
}, | ||
|
||
xSeconds: { | ||
one: '1 segond', | ||
other: '{{count}} segond', | ||
}, | ||
|
||
halfAMinute: '30 segond', | ||
|
||
lessThanXMinutes: { | ||
one: 'mwens pase yon minit', | ||
other: 'mwens pase {{count}} minit', | ||
}, | ||
|
||
xMinutes: { | ||
one: '1 minit', | ||
other: '{{count}} minit', | ||
}, | ||
|
||
aboutXHours: { | ||
one: 'anviwon inè', | ||
other: 'anviwon {{count}} è', | ||
}, | ||
|
||
xHours: { | ||
one: '1 lè', | ||
other: '{{count}} lè', | ||
}, | ||
|
||
xDays: { | ||
one: '1 jou', | ||
other: '{{count}} jou', | ||
}, | ||
|
||
aboutXWeeks: { | ||
one: 'anviwon 1 semèn', | ||
other: 'anviwon {{count}} semèn', | ||
}, | ||
|
||
xWeeks: { | ||
one: '1 semèn', | ||
other: '{{count}} semèn', | ||
}, | ||
|
||
aboutXMonths: { | ||
one: 'anviwon 1 mwa', | ||
other: 'anviwon {{count}} mwa', | ||
}, | ||
|
||
xMonths: { | ||
one: '1 mwa', | ||
other: '{{count}} mwa', | ||
}, | ||
|
||
aboutXYears: { | ||
one: 'anviwon 1 an', | ||
other: 'anviwon {{count}} an', | ||
}, | ||
|
||
xYears: { | ||
one: '1 an', | ||
other: '{{count}} an', | ||
}, | ||
|
||
overXYears: { | ||
one: 'plis pase 1 an', | ||
other: 'plis pase {{count}} an', | ||
}, | ||
|
||
almostXYears: { | ||
one: 'prèske 1 an', | ||
other: 'prèske {{count}} an', | ||
}, | ||
} | ||
|
||
export default function formatDistance(token, count, options) { | ||
options = options || {} | ||
|
||
var result | ||
if (typeof formatDistanceLocale[token] === 'string') { | ||
result = formatDistanceLocale[token] | ||
} else if (count === 1) { | ||
result = formatDistanceLocale[token].one | ||
} else { | ||
result = formatDistanceLocale[token].other.replace('{{count}}', count) | ||
} | ||
|
||
if (options.addSuffix) { | ||
if (options.comparison > 0) { | ||
return 'nan ' + result | ||
} else { | ||
return 'sa fè ' + result | ||
} | ||
} | ||
|
||
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,41 @@ | ||
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index' | ||
|
||
var dateFormats = { | ||
full: 'EEEE d MMMM y', | ||
long: 'd MMMM y', | ||
medium: 'd MMM y', | ||
short: 'dd/MM/y', | ||
} | ||
|
||
var timeFormats = { | ||
full: 'HH:mm:ss zzzz', | ||
long: 'HH:mm:ss z', | ||
medium: 'HH:mm:ss', | ||
short: 'HH:mm', | ||
} | ||
|
||
var dateTimeFormats = { | ||
full: "{{date}} 'nan lè' {{time}}", | ||
long: "{{date}} 'nan lè' {{time}}", | ||
medium: '{{date}}, {{time}}', | ||
short: '{{date}}, {{time}}', | ||
} | ||
|
||
var formatLong = { | ||
date: buildFormatLongFn({ | ||
formats: dateFormats, | ||
defaultWidth: 'full', | ||
}), | ||
|
||
time: buildFormatLongFn({ | ||
formats: timeFormats, | ||
defaultWidth: 'full', | ||
}), | ||
|
||
dateTime: buildFormatLongFn({ | ||
formats: dateTimeFormats, | ||
defaultWidth: 'full', | ||
}), | ||
} | ||
|
||
export default formatLong |
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,12 @@ | ||
var formatRelativeLocale = { | ||
lastWeek: "eeee 'pase nan lè' p", | ||
yesterday: "'yè nan lè' p", | ||
today: "'jodi a' p", | ||
tomorrow: "'demen nan lè' p'", | ||
nextWeek: "eeee 'pwochen nan lè' p", | ||
other: 'P', | ||
} | ||
|
||
export default function formatRelative(token, _date, _baseDate, _options) { | ||
return 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,19 @@ | ||
var formatters = {} | ||
|
||
// Special case for day of month ordinals in long date format context: | ||
// 1er mars, 2 mars, 3 mars, … | ||
// See https://github.com/date-fns/date-fns/issues/437 | ||
var monthsTokens = ['MMM', 'MMMM'] | ||
monthsTokens.forEach(function (monthToken) { | ||
formatters['Do ' + monthToken] = function (date, options) { | ||
var commonFormatters = options.formatters | ||
var dayOfMonthToken = date.getUTCDate() === 1 ? 'Do' : 'D' | ||
var dayOfMonthFormatter = commonFormatters[dayOfMonthToken] | ||
var monthFormatter = commonFormatters[monthToken] | ||
return ( | ||
dayOfMonthFormatter(date, options) + ' ' + monthFormatter(date, options) | ||
) | ||
} | ||
}) | ||
|
||
export default formatters |
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,147 @@ | ||
import buildLocalizeFn from '../../../_lib/buildLocalizeFn/index' | ||
|
||
var eraValues = { | ||
narrow: ['av. J.-K', 'ap. J.-K'], | ||
abbreviated: ['av. J.-K', 'ap. J.-K'], | ||
wide: ['anvan Jezi Kris', 'apre Jezi Kris'], | ||
} | ||
|
||
var quarterValues = { | ||
narrow: ['T1', 'T2', 'T3', 'T4'], | ||
abbreviated: ['1ye trim.', '2yèm trim.', '3yèm trim.', '4yèm trim.'], | ||
wide: ['1ye trimès', '2yèm trimès', '3yèm trimès', '4yèm trimès'], | ||
} | ||
|
||
var monthValues = { | ||
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'O', 'S', 'O', 'N', 'D'], | ||
abbreviated: [ | ||
'janv.', | ||
'fevr.', | ||
'mas', | ||
'avr.', | ||
'me', | ||
'jen', | ||
'jiyè', | ||
'out', | ||
'sept.', | ||
'okt.', | ||
'nov.', | ||
'des.', | ||
], | ||
wide: [ | ||
'janvye', | ||
'fevrye', | ||
'mas', | ||
'avril', | ||
'me', | ||
'jen', | ||
'jiyè', | ||
'out', | ||
'septanm', | ||
'oktòb', | ||
'novanm', | ||
'desanm', | ||
], | ||
} | ||
|
||
var dayValues = { | ||
narrow: ['D', 'L', 'M', 'M', 'J', 'V', 'S'], | ||
short: ['di', 'le', 'ma', 'mè', 'je', 'va', 'sa'], | ||
abbreviated: ['dim.', 'len.', 'mad.', 'mèk.', 'jed.', 'van.', 'sam.'], | ||
wide: ['dimanch', 'lendi', 'madi', 'mèkredi', 'jedi', 'vandredi', 'samdi'], | ||
} | ||
|
||
var dayPeriodValues = { | ||
narrow: { | ||
am: 'AM', | ||
pm: 'PM', | ||
midnight: 'minwit', | ||
noon: 'midi', | ||
morning: 'mat.', | ||
afternoon: 'ap.m.', | ||
evening: 'swa', | ||
night: 'mat.', | ||
}, | ||
abbreviated: { | ||
am: 'AM', | ||
pm: 'PM', | ||
midnight: 'minwit', | ||
noon: 'midi', | ||
morning: 'maten', | ||
afternoon: 'aprèmidi', | ||
evening: 'swa', | ||
night: 'maten', | ||
}, | ||
wide: { | ||
am: 'AM', | ||
pm: 'PM', | ||
midnight: 'minwit', | ||
noon: 'midi', | ||
morning: 'nan maten', | ||
afternoon: 'nan aprèmidi', | ||
evening: 'nan aswè', | ||
night: 'nan maten', | ||
}, | ||
} | ||
|
||
function ordinalNumber(dirtyNumber, dirtyOptions) { | ||
var number = Number(dirtyNumber) | ||
|
||
var options = dirtyOptions || {} | ||
var unit = String(options.unit) | ||
var suffix | ||
|
||
if (number === 0) { | ||
return number | ||
} | ||
|
||
if (unit === 'year' || unit === 'hour' || unit === 'week') { | ||
if (number === 1) { | ||
suffix = 'ye' | ||
} else { | ||
suffix = 'yèm' | ||
} | ||
} else { | ||
if (number === 1) { | ||
suffix = 'ye' | ||
} else { | ||
suffix = 'yèm' | ||
} | ||
} | ||
|
||
return number + suffix | ||
} | ||
|
||
var localize = { | ||
ordinalNumber: ordinalNumber, | ||
|
||
era: buildLocalizeFn({ | ||
values: eraValues, | ||
defaultWidth: 'wide', | ||
}), | ||
|
||
quarter: buildLocalizeFn({ | ||
values: quarterValues, | ||
defaultWidth: 'wide', | ||
argumentCallback: function (quarter) { | ||
return Number(quarter) - 1 | ||
}, | ||
}), | ||
|
||
month: buildLocalizeFn({ | ||
values: monthValues, | ||
defaultWidth: 'wide', | ||
}), | ||
|
||
day: buildLocalizeFn({ | ||
values: dayValues, | ||
defaultWidth: 'wide', | ||
}), | ||
|
||
dayPeriod: buildLocalizeFn({ | ||
values: dayPeriodValues, | ||
defaultWidth: 'wide', | ||
}), | ||
} | ||
|
||
export default localize |
Oops, something went wrong.