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

D2M #793

Merged
merged 8 commits into from
Feb 4, 2020
1 change: 1 addition & 0 deletions docs/en/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const localeObject = {
weekdaysShort: 'Sun_M'.split('_'), // OPTIONAL, short weekdays Array, use first three letters if not provided
weekdaysMin: 'Su_Mo'.split('_'), // OPTIONAL, min weekdays Array, use first two letters if not provided
weekStart: 1, // OPTIONAL, set the start of a week. If the value is 1, Monday will be the start of week instead of Sunday。
yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
months: 'Enero_Febrero ... '.split('_'), // months Array
monthsShort: 'Jan_F'.split('_'), // OPTIONAL, short months Array, use first three letters if not provided
ordinal: n => `${n}º`, // ordinal Function (number) => return number + output
Expand Down
2 changes: 2 additions & 0 deletions docs/es-es/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ const localeObject = {
weekdays: 'Domingo_Lunes ...'.split('_'), // weekdays Array
weekdaysShort: 'Sun_M'.split('_'), // OPTIONAL, short weekdays Array, use first three letters if not provided
weekdaysMin: 'Su_Mo'.split('_'), // OPTIONAL, min weekdays Array, use first two letters if not provided
weekStart: 1, // OPTIONAL, set the start of a week. If the value is 1, Monday will be the start of week instead of Sunday。
yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
months: 'Enero_Febrero ... '.split('_'), // months Array
monthsShort: 'Jan_F'.split('_'), // OPTIONAL, short months Array, use first three letters if not provided
ordinal: n => `${n}º`, // ordinal Function (number) => return number + output
Expand Down
1 change: 1 addition & 0 deletions docs/ja/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const localeObject = {
weekdaysShort: 'Sun_M'.split('_'), // OPTIONAL, short weekdays Array, use first three letters if not provided
weekdaysMin: 'Su_Mo'.split('_'), // OPTIONAL, min weekdays Array, use first two letters if not provided
weekStart: 1, // OPTIONAL, 最初の曜日を指定する。0は日曜日です。1は月曜日です。
yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
months: 'Enero_Febrero ... '.split('_'), // 月の配列
monthsShort: 'Jan_F'.split('_'), // OPTIONAL, short months Array, use first three letters if not provided
ordinal: n => `${n}º`, // 序数 Function (number) => return number + output
Expand Down
1 change: 1 addition & 0 deletions docs/ko/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const localeObject = {
weekdaysShort: 'Sun_M'.split('_'), // OPTIONAL, short weekdays Array, use first three letters if not provided
weekdaysMin: 'Su_Mo'.split('_'), // OPTIONAL, min weekdays Array, use first two letters if not provided
weekStart: 1, // OPTIONAL, set the start of a week. If the value is 1, Monday will be the start of week instead of Sunday。
yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
months: 'Enero_Febrero ... '.split('_'), // months Array
monthsShort: 'Jan_F'.split('_'), // OPTIONAL, short months Array, use first three letters if not provided
ordinal: n => `${n}º`, // ordinal Function (number) => return number + output
Expand Down
1 change: 1 addition & 0 deletions docs/pt-br/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const objetoLocale = {
weekdaysShort: 'Sun_M'.split('_'), // OPCIONAL, dias da semana com nome curto: Array, utiliza as três primeiras letras se nenhuma for especificada
weekdaysMin: 'Su_Mo'.split('_'), // OPCIONAL, dias da semana com nome mínimo: Array, utiliza as duas primeiras letras se nenhuma for especificada
weekStart: 1, // OPCIONAL, define o início da semana. Se o valor for 1, Segunda-feira será o início da semana ao invés de Domingo。
yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
months: 'Enero_Febrero ... '.split('_'), // meses: Array
monthsShort: 'Jan_F'.split('_'), // OPCIONAL, meses com nome curto: Array, utiliza as três primeiras letras se nenhuma for especificada
ordinal: n => `${n}º`, // ordinal: Function (number) => retorna number + saída
Expand Down
1 change: 1 addition & 0 deletions docs/zh-cn/I18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const localeObject = {
weekdaysShort: 'Sun_M'.split('_'), // 可选, 短的星期 Array, 如果没提供则使用前三个字符
weekdaysMin: 'Su_Mo'.split('_'), // 可选, 最短的星期 Array, 如果没提供则使用前两个字符
weekStart: 1, // 可选,指定一周的第一天。默认为0,即周日。如果为1,则周一为一周得第一天。
yearStart: 4, // 可选,包含1月4日的周为一年的第一周
months: 'Enero_Febrero ... '.split('_'), // 月份 Array
monthsShort: 'Jan_F'.split('_'), // 可选, 短的月份 Array, 如果没提供则使用前三个字符
ordinal: n => `${n}º`, // 序号生成工厂函数 Function (number) => return number + output
Expand Down
1 change: 1 addition & 0 deletions src/locale/af.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Afrikaans [af]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-dz.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Algeria) [ar-dz]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-kw.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Kuwait) [ar-kw]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-ly.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Lybia) [ar-ly]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-ma.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Morocco) [ar-ma]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-sa.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Saudi Arabia) [ar-sa]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar-tn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic (Tunisia) [ar-tn]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Arabic [ar]
import dayjs from 'dayjs'

const months = 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_')
Expand Down
1 change: 1 addition & 0 deletions src/locale/az.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Azerbaijani [az]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/be.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Belarusian [be]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/bg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Bulgarian [bg]
import dayjs from 'dayjs'

const locale = {
Expand Down
39 changes: 39 additions & 0 deletions src/locale/bi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import dayjs from 'dayjs'

const locale = {
name: 'bi',
weekdays: 'Sande_Mande_Tusde_Wenesde_Tosde_Fraede_Sarade'.split('_'),
months: 'Januari_Februari_Maj_Eprel_Mei_Jun_Julae_Okis_Septemba_Oktoba_Novemba_Disemba'.split('_'),
weekStart: 1,
weekdaysShort: 'San_Man_Tus_Wen_Tos_Frae_Sar'.split('_'),
monthsShort: 'Jan_Feb_Maj_Epr_Mai_Jun_Jul_Oki_Sep_Okt_Nov_Dis'.split('_'),
weekdaysMin: 'San_Ma_Tu_We_To_Fr_Sar'.split('_'),
ordinal: n => n,
formats: {
LT: 'h:mm A',
LTS: 'h:mm:ss A',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY h:mm A',
LLLL: 'dddd, D MMMM YYYY h:mm A'
},
relativeTime: {
future: 'lo %s',
past: '%s bifo',
s: 'sam seken',
m: 'wan minit',
mm: '%d minit',
h: 'wan haoa',
hh: '%d haoa',
d: 'wan dei',
dd: '%d dei',
M: 'wan manis',
MM: '%d manis',
y: 'wan yia',
yy: '%d yia'
}
}

dayjs.locale(locale, null, true)

export default locale
1 change: 1 addition & 0 deletions src/locale/bm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Bambara [bm]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/bn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Bengali [bn]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/bo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Tibetan [bo]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/br.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Breton [br]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/bs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Bosnian [bs]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ca.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Catalan [ca]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/cs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Czech [cs]
import dayjs from 'dayjs'

function plural(n) {
Expand Down
1 change: 1 addition & 0 deletions src/locale/cv.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Chuvash [cv]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/cy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Welsh [cy]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/da.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Danish [da]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/de-at.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// German (Austria) [de-at]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/de-ch.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// German (Switzerland) [de-ch]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/de.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// German [de]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/dv.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Maldivian [dv]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/el.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Greek [el]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-SG.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (Singapore) [en-sg]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-au.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (Australia) [en-au]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-ca.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (Canada) [en-ca]
import dayjs from 'dayjs'

const locale = {
Expand Down
2 changes: 2 additions & 0 deletions src/locale/en-gb.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (United Kingdom) [en-gb]
import dayjs from 'dayjs'

const locale = {
Expand All @@ -8,6 +9,7 @@ const locale = {
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekStart: 1,
yearStart: 4,
relativeTime: {
future: 'in %s',
past: '%s ago',
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-ie.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (Ireland) [en-ie]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-il.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (Israel) [en-il]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/en-nz.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// English (New Zealand) [en-nz]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/eo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Esperanto [eo]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/es-do.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Spanish (Dominican Republic) [es-do]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/es-us.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Spanish (United States) [es-us]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/es.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Spanish [es]
import dayjs from 'dayjs'

const locale = {
Expand Down
50 changes: 31 additions & 19 deletions src/locale/et.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
// Estonian [et]
import dayjs from 'dayjs'

function relativeTimeWithTense(number, withoutSuffix, key, isFuture) {
const format = {
s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
m: ['ühe minuti', 'üks minut'],
mm: ['%d minuti', '%d minutit'],
h: ['ühe tunni', 'tund aega', 'üks tund'],
hh: ['%d tunni', '%d tundi'],
d: ['ühe päeva', 'üks päev'],
M: ['kuu aja', 'kuu aega', 'üks kuu'],
MM: ['%d kuu', '%d kuud'],
y: ['ühe aasta', 'aasta', 'üks aasta'],
yy: ['%d aasta', '%d aastat']
}
if (withoutSuffix) {
return (format[key][2] ? format[key][2] : format[key][1]).replace('%d', number)
}
return (isFuture ? format[key][0] : format[key][1]).replace('%d', number)
}

const locale = {
name: 'et', // Estonian
weekdays: 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), // Note weekdays are not capitalized in Estonian
Expand All @@ -9,28 +29,20 @@ const locale = {
monthsShort: 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
ordinal: n => `${n}.`,
weekStart: 1,
/*
* This relativeTime is currently configured for having proper past
* tense forms since Estonian 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 pärast',
past: '%s tagasi',
s: 'mõni sekund', // for past tense
m: 'minut', // for past tense
mm: '%d minutit', // for past tense
h: 'tund', // for past tense
hh: '%d tundi', // for past tense
d: 'päev', // for past tense
dd: '%d päeva', // for past tense
M: 'kuu', // for past tense
MM: '%d kuud', // for past tense
y: 'aasta', // for past tense
yy: '%d aastat' // for past tense
s: relativeTimeWithTense,
m: relativeTimeWithTense,
mm: relativeTimeWithTense,
h: relativeTimeWithTense,
hh: relativeTimeWithTense,
d: relativeTimeWithTense,
dd: '%d päeva',
M: relativeTimeWithTense,
MM: relativeTimeWithTense,
y: relativeTimeWithTense,
yy: relativeTimeWithTense
},
formats: {
LT: 'H:mm',
Expand Down
1 change: 1 addition & 0 deletions src/locale/eu.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Basque [eu]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fa.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Persian [fa]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fi.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Finnish [fi]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Faroese [fo]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr-ca.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// French (Canada) [fr-ca]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr-ch.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// French (Switzerland) [fr-ch]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// French [fr]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Frisian [fy]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ga.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Irish or Irish Gaelic [ga]
import dayjs from 'dayjs'

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/gd.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Scottish Gaelic [gd]
import dayjs from 'dayjs'

const locale = {
Expand Down
Loading