diff --git a/demo/src/app/components/+datepicker/demo-datepicker.module.ts b/demo/src/app/components/+datepicker/demo-datepicker.module.ts index ea8e20e890..65c3bfe6ad 100644 --- a/demo/src/app/components/+datepicker/demo-datepicker.module.ts +++ b/demo/src/app/components/+datepicker/demo-datepicker.module.ts @@ -13,10 +13,10 @@ import { routes } from './demo-datepicker.routes'; import { defineLocale } from 'ngx-bootstrap/bs-moment'; import { - ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, ru, zhCn, tr + ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr } from 'ngx-bootstrap/locale'; -const locales = [ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, ru, zhCn, tr]; +const locales = [ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr]; locales.forEach(locale => defineLocale(locale.abbr, locale)); diff --git a/src/bs-moment/i18n/sv.ts b/src/bs-moment/i18n/sv.ts new file mode 100644 index 0000000000..7d857f635a --- /dev/null +++ b/src/bs-moment/i18n/sv.ts @@ -0,0 +1,61 @@ +// moment.js locale configuration +// locale : Swedish [sv] +// author : Jens Alm : https://github.com/ulmus + +import { LocaleData } from '../locale/locale.class'; + +export const sv: LocaleData = { + abbr: 'sv', + months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), + monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), + weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), + weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'YYYY-MM-DD', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY [kl.] HH:mm', + LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', + lll : 'D MMM YYYY HH:mm', + llll : 'ddd D MMM YYYY HH:mm' + }, + calendar : { + sameDay: '[Idag] LT', + nextDay: '[Imorgon] LT', + lastDay: '[Igår] LT', + nextWeek: '[På] dddd LT', + lastWeek: '[I] dddd[s] LT', + sameElse: 'L' + }, + relativeTime : { + future : 'om %s', + past : 'för %s sedan', + s : 'några sekunder', + m : 'en minut', + mm : '%d minuter', + h : 'en timme', + hh : '%d timmar', + d : 'en dag', + dd : '%d dagar', + M : 'en månad', + MM : '%d månader', + y : 'ett år', + yy : '%d år' + }, + dayOfMonthOrdinalParse: /\d{1,2}(e|a)/, + ordinal : function (number) { + const b = number % 10, + // tslint:disable-next-line:no-bitwise + output = (~~(number % 100 / 10) === 1) ? 'e' : + (b === 1) ? 'a' : + (b === 2) ? 'a' : + (b === 3) ? 'e' : 'e'; + return number + output; + }, + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } +}; diff --git a/src/locale.ts b/src/locale.ts index 73f10cc6f2..893a872554 100644 --- a/src/locale.ts +++ b/src/locale.ts @@ -14,6 +14,7 @@ export { nl } from './bs-moment/i18n/nl'; export { nlBe } from './bs-moment/i18n/nl-be'; export { pl } from './bs-moment/i18n/pl'; export { ptBr } from './bs-moment/i18n/pt-br'; +export { sv } from './bs-moment/i18n/sv'; export { ru } from './bs-moment/i18n/ru'; export { zhCn } from './bs-moment/i18n/zh-cn'; export { tr } from './bs-moment/i18n/tr';