-
Notifications
You must be signed in to change notification settings - Fork 53
Language
PIGNOSE edited this page Nov 26, 2017
·
13 revisions
You can customize language by giving new `weeks`, `monthsLong`, `months`, `controls`.
If your language follows below condition,
You can customize to follow basic
guideline.
[Condition]
You use multiple calendar that follow a default language.
// setting feature is support from `v1.4.14` version.
$('.calendar').pignoseCalendar('setting', {
// date format follows moment sheet.
// Check below link.
// https://momentjs.com/docs/#/parsing/string-format/
format: 'YYYY-MM-DD',
// Starting day of week. (0 is Sunday[default], 6 is Saturday
// and all day of week is in consecutive order.
// In this example, We will start from Saturday.
week: 6,
language: 'custom', // Default Language
languages: {
// You will set `custom` language.
'custom': {
// Weeks sun ~ sat.
weeks: [
'1st',
'2nd',
'3rd',
'4th',
'5th',
'6th',
'7th'
],
// Month long names January ~ December
monthsLong: [
'1st',
'2nd',
'3rd',
'4th',
'5th',
'6th',
'7th',
'8th',
'9th',
'10th',
'11th',
'12th'
],
// Month short names Jan ~ Dec
months: [
'1st',
'2nd',
'3rd',
'4th',
'5th',
'6th',
'7th',
'8th',
'9th',
'10th',
'11th',
'12th'
],
// Other control words
controls: {
ok: 'ok',
cancel: 'cancel'
}
}
}
});
If your language follows below condition,
You can customize to follow quick fix
guideline.
[Condition]
You use multiple calendar that support multiple languages.
$('.calendar').pignoseCalendar({
// date format follows moment sheet.
// Check below link.
// https://momentjs.com/docs/#/parsing/string-format/
format: 'YYYY-MM-DD',
// Starting day of week. (0 is Sunday[default], 6 is Saturday
// and all day of week is in consecutive order.
// In this example, We will start from Saturday.
week: 6,
// Weeks sun ~ sat.
weeks: [
],
// Month long names January ~ December
monthLong: [
],
// Month short names Jan ~ Dec
months: [
],
// Controls name
controls: {
// OK translataion word
ok: '{:ok}',
// Cancel translation word
cancel: '{:cancel}'
}
});
Follow this code. We are already fill up sample language (English).
$('.calendar').pignoseCalendar({
format: 'YYYY-MM-DD',
weeks: [
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat'
],
monthLong: [
'January',
'February',
'March',
'April',
'May',
'Jun',
'July',
'August',
'September',
'October',
'November',
'December'
],
months: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
],
controls: {
ok: 'OK',
cancel: 'Cancel'
}
});
You can add your language by editing i18n settings, And send as Pull request.
I will merge your language ASAP.
Thank you 😄.