From 9e4df4789197f64239431f36caff43696a6f6695 Mon Sep 17 00:00:00 2001 From: Umit Gunduz Date: Fri, 29 Sep 2017 13:41:05 +0300 Subject: [PATCH] feat(datepicker): added Turkish locale support for datepicker feat(datepicker): added Turkish locale support for datepicker --- .../+datepicker/demo-datepicker.module.ts | 4 +- src/bs-moment/i18n/tr.ts | 58 +++++++++++++++++++ src/locale.ts | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/bs-moment/i18n/tr.ts diff --git a/demo/src/app/components/+datepicker/demo-datepicker.module.ts b/demo/src/app/components/+datepicker/demo-datepicker.module.ts index 28554b3c98..ea8e20e890 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 + ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, 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]; +const locales = [ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, ru, zhCn, tr]; locales.forEach(locale => defineLocale(locale.abbr, locale)); diff --git a/src/bs-moment/i18n/tr.ts b/src/bs-moment/i18n/tr.ts new file mode 100644 index 0000000000..6d3a6af401 --- /dev/null +++ b/src/bs-moment/i18n/tr.ts @@ -0,0 +1,58 @@ +// moment.js locale configuration +// locale : Turkish [tr] +// author : Umit Gündüz : https://github.com/umitgunduz + +import { LocaleData } from '../locale/locale.class'; + + +export const tr: LocaleData = { + abbr: 'tr', + months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split( + '_' + ), + monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), + weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split( + '_' + ), + weekdaysShort: 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), + weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + calendar: { + sameDay: '[bugün saat] LT', + nextDay: '[yarın saat] LT', + nextWeek: '[haftaya] dddd [saat] LT', + lastDay: '[dün] LT', + lastWeek: '[geçen hafta] dddd [saat] LT', + sameElse: 'L' + }, + relativeTime: { + future : '%s sonra', + past : '%s önce', + s : 'birkaç saniye', + m : 'bir dakika', + mm : '%d dakika', + h : 'bir saat', + hh : '%d saat', + d : 'bir gün', + dd : '%d gün', + M : 'bir ay', + MM : '%d ay', + y : 'bir yıl', + yy : '%d yıl' + }, + dayOfMonthOrdinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, + ordinal(num: number, token?: string): string { + return `${num}.`; + }, + 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 2018034453..73f10cc6f2 100644 --- a/src/locale.ts +++ b/src/locale.ts @@ -16,3 +16,4 @@ export { pl } from './bs-moment/i18n/pl'; export { ptBr } from './bs-moment/i18n/pt-br'; export { ru } from './bs-moment/i18n/ru'; export { zhCn } from './bs-moment/i18n/zh-cn'; +export { tr } from './bs-moment/i18n/tr';