Open kukicvladimir opened 4 years ago
@valorkin if you need translation we can help translate it to sr-Cyrl and sr-Latn.
Here is the sr-latn-rs locale
import { LocaleData } from 'ngx-bootstrap';
export const srLatnLocale: LocaleData = {
abbr: 'sr-latn-rs',
months: 'Januar_Februar_Mart_April_Maj_Jun_Jul_Avgust_Septembar_Oktobar_Novembar_Decembar'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_Maj_Jun_Jul_Avg_Sep_Okt_Nov_Dec'.split('_'),
weekdays: 'Nedelja_Ponedeljak_Utorak_Sreda_Četvrtak_Petak_Subota'.split('_'),
weekdaysShort: 'Ned_Pon_Uto_Sre_Čet_Pet_Sub'.split('_'),
weekdaysMin: 'Ne_Po_Ut_Sr_Če_Pe_Su'.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: '[Danas u] LT',
nextDay: '[Sutra u] LT',
nextWeek: 'dddd [u] LT',
lastDay: '[Juče u] LT',
lastWeek: '[Prošle] dddd [u] LT',
sameElse: 'L'
},
invalidDate: 'Nevažeći datum',
relativeTime: {
future: 'za %s',
past: '%s pre',
s: 'nekoliko sekundi',
ss: '%d sekundi',
m: 'minuta',
mm: '%d minuta',
h: 'sat',
hh: '%d sati',
d: 'dan',
dd: '%d dana',
M: 'mesec dana',
MM: '%d meseci',
y: 'godina',
yy: '%d godina'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal(_num: number): string {
const num = Number(_num);
const b = num % 10,
output = (~~(num % 100 / 10) === 1) ? '.' :
(b === 1) ? '.' :
(b === 2) ? '.' :
(b === 3) ? '.' : '.';
return num + 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.
}
};
Here is sr-cyrl-rs locale
import { LocaleData } from 'ngx-bootstrap';
export const srCyrlLocale: LocaleData = {
abbr: 'sr-cyrl-rs',
months: 'Јануар_Фебруар_Март_Април_Мај_Јун_Јул_Август_Септембар_Октобар_Новембар_Децембар'.split('_'),
monthsShort: 'Јан_Феб_Мар_Апр_Мај_Јун_Јул_Авг_Сеп_Окт_Нов_Дец'.split('_'),
weekdays: 'Недеља_Понедељак_Уторак_Среда_Четвртак_Петак_Субота'.split('_'),
weekdaysShort: 'Нед_Пон_Уто_Сре_Чет_Пет_Суб'.split('_'),
weekdaysMin: 'Не_По_Ут_Ср_Че_Пе_Су'.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: '[Данас y] LT',
nextDay: '[Сутра y] LT',
nextWeek: 'dddd [y] LT',
lastDay: '[Јуче y] LT',
lastWeek: '[Прошле] dddd [y] LT',
sameElse: 'L'
},
invalidDate: 'Неважећи датум',
relativeTime: {
future: 'за %s',
past: '%s пре',
s: 'неколико секунди',
ss: '%d секунди',
m: 'минутa',
mm: '%d минутa',
h: 'сат',
hh: '%d сати',
d: 'дан',
dd: '%d дана',
M: 'месец дана',
MM: '%d месеци',
y: 'годинa',
yy: '%d годинa'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal(_num: number): string {
const num = Number(_num);
const b = num % 10,
output = (~~(num % 100 / 10) === 1) ? '.' :
(b === 1) ? '.' :
(b === 2) ? '.' :
(b === 3) ? '.' : '.';
return num + 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.
}
};
Authors if you want I can create PR, but have no time to finalize it (unit tests). @kukicvladimir could you please check my translations.
@surexxx After reviewing the submitted file, I have noticed that date formats and weekdaysMin
would be slightly different
weekdaysMin: 'Н_По_У_Ср_Ч_Пе_Су'.split('_'), longDateFormat: { LT: 'H:mm', LTS: 'H:mm:ss', L: 'YYYY.MM.DD.', LL: 'YYYY. MMMM D.', LLL: 'YYYY. MMMM D. H:mm', LLLL: 'YYYY. MMMM D., dddd H:mm' },
Should be converted to this
weekdaysMin: 'Не_По_Ут_Ср_Че_Пе_Су'.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'
},```
the rest looks ok to me.
@kukicvladimir thanks for the review. I've updated my original comment.
@kukicvladimir do I need to change these formats also in sr-latn-rs version?
@kukicvladimir do I need to change these formats also in sr-latn-rs version?
yes, there should be no difference between the two
Both code have been updated.
woah, thanks for the great work, guys @kukicvladimir @surexxx !
Can I create a PR with these locales?
woah, thanks for the great work, guys @kukicvladimir @surexxx !
Can I create a PR with these locales?
Sure, I don't think this requires any additional work
@daniloff200 please create a PR, but don't forget the unit tests also... otherwise it won't be approved and merged. And please list us both among the authors ;)
Add sr and sr-latn locale
Datepicker does not support Serbian latin and cyrillic locales.
Add translation files to chronos