Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Finnish locale #351

Merged
merged 3 commits into from
Sep 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/locale/fi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import dayjs from 'dayjs'

const locale = {
name: 'fi', // Finnish
weekdays: 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), // Note weekdays are not capitalized in Finnish
weekdaysShort: 'su_ma_ti_ke_to_pe_la'.split('_'), // There is no short form of weekdays in Finnish except this 2 letter format so it is used for both 'weekdaysShort' and 'weekdaysMin'
weekdaysMin: 'su_ma_ti_ke_to_pe_la'.split('_'),
months: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), // Note month names are not capitalized in Finnish
monthsShort: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), // There is no short form of months in Finnish so just use the regular long form always
ordinal: n => `${n}.`,
/*
* This relativeTime is currently configured for having proper past
* tense forms since Finnish needs a separate version for future tense
* and I think past tense is a more common use case for this kind of
* library.
*
* Doing this properly requires this issue to be fixed:
* https://github.com/iamkun/dayjs/issues/302
*/
relativeTime: {
future: '%s kuluttua',
past: '%s sitten',
s: 'muutama sekunti', // for past tense
m: 'minuutti', // for past tense
mm: '%d minuuttia', // for past tense
h: 'tunti', // for past tense
hh: '%d tuntia', // for past tense
d: 'päivä', // for past tense
dd: '%d päivää', // for past tense
M: 'kuukausi', // for past tense
MM: '%d kuukautta', // for past tense
y: 'vuosi', // for past tense
yy: '%d vuotta' // for past tense
}
}

dayjs.locale(locale, null, true)

export default locale