Skip to content

Commit

Permalink
Merge pull request #793 from iamkun/dev
Browse files Browse the repository at this point in the history
D2M
  • Loading branch information
iamkun committed Feb 4, 2020
2 parents 731b947 + d8e0f45 commit 372b253
Show file tree
Hide file tree
Showing 143 changed files with 404 additions and 53 deletions.
1 change: 1 addition & 0 deletions docs/en/I18n.md
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
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
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
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
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
// Azerbaijani [az]
import dayjs from 'dayjs'

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

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

const locale = {
Expand Down
39 changes: 39 additions & 0 deletions src/locale/bi.js
@@ -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
@@ -1,3 +1,4 @@
// Bambara [bm]
import dayjs from 'dayjs'

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

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

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

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

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

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/cs.js
@@ -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
@@ -1,3 +1,4 @@
// Chuvash [cv]
import dayjs from 'dayjs'

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

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/da.js
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
// German [de]
import dayjs from 'dayjs'

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

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/el.js
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
// Spanish [es]
import dayjs from 'dayjs'

const locale = {
Expand Down
50 changes: 31 additions & 19 deletions src/locale/et.js
@@ -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
@@ -1,3 +1,4 @@
// Basque [eu]
import dayjs from 'dayjs'

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

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

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/fo.js
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
// French [fr]
import dayjs from 'dayjs'

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

const locale = {
Expand Down
1 change: 1 addition & 0 deletions src/locale/ga.js
@@ -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
@@ -1,3 +1,4 @@
// Scottish Gaelic [gd]
import dayjs from 'dayjs'

const locale = {
Expand Down

0 comments on commit 372b253

Please sign in to comment.