From dda017efe2c993ae1e1cdea79c6e7b9fdbd890ca Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Wed, 21 May 2014 17:00:51 -0700 Subject: [PATCH] allow user-specified buttonText to override buttonIcons --- lang/ar.js | 4 ++-- lang/bg.js | 4 ++-- lang/ca.js | 4 ++-- lang/cs.js | 4 ++-- lang/da.js | 4 ++-- lang/de.js | 4 ++-- lang/el.js | 4 ++-- lang/en-gb.js | 2 +- lang/es.js | 4 ++-- lang/fa.js | 4 ++-- lang/fi.js | 4 ++-- lang/fr.js | 4 ++-- lang/hi.js | 4 ++-- lang/hr.js | 4 ++-- lang/hu.js | 4 ++-- lang/in.js | 4 ++-- lang/it.js | 4 ++-- lang/iw.js | 4 ++-- lang/ja.js | 4 ++-- lang/ko.js | 4 ++-- lang/lt.js | 4 ++-- lang/lv.js | 4 ++-- lang/nl.js | 4 ++-- lang/no.js | 4 ++-- lang/pl.js | 4 ++-- lang/pt-br.js | 4 ++-- lang/pt.js | 4 ++-- lang/ro.js | 4 ++-- lang/ru.js | 4 ++-- lang/sk.js | 4 ++-- lang/sl.js | 4 ++-- lang/sr.js | 4 ++-- lang/sv.js | 4 ++-- lang/th.js | 4 ++-- lang/tl.js | 4 ++-- lang/tr.js | 4 ++-- lang/uk.js | 4 ++-- lang/vi.js | 4 ++-- lang/zh-cn.js | 4 ++-- lang/zh-tw.js | 4 ++-- src/Header.js | 10 +++++++--- src/defaults.js | 2 +- src/lang.js | 2 +- src/util.js | 1 + 44 files changed, 89 insertions(+), 84 deletions(-) diff --git a/lang/ar.js b/lang/ar.js index 1c17832..22d5c57 100644 --- a/lang/ar.js +++ b/lang/ar.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("ar", { - buttonText: { + defaultButtonText: { month: "شهر", week: "أسبوع", day: "يوم", list: "أجندة" }, allDayText: "اليوم كله" -}); \ No newline at end of file +}); diff --git a/lang/bg.js b/lang/bg.js index 1878396..2b16c4a 100644 --- a/lang/bg.js +++ b/lang/bg.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("bg", { - buttonText: { + defaultButtonText: { month: "Месец", week: "Седмица", day: "Ден", list: "График" }, allDayText: "Цял ден" -}); \ No newline at end of file +}); diff --git a/lang/ca.js b/lang/ca.js index 016cbd7..2830fee 100644 --- a/lang/ca.js +++ b/lang/ca.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("ca", { - buttonText: { + defaultButtonText: { month: "Mes", week: "Setmana", day: "Dia", list: "Agenda" }, allDayText: "Tot el dia" -}); \ No newline at end of file +}); diff --git a/lang/cs.js b/lang/cs.js index f17f5ad..ef9a065 100644 --- a/lang/cs.js +++ b/lang/cs.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("cs", { - buttonText: { + defaultButtonText: { month: "Měsíc", week: "Týden", day: "Den", list: "Agenda" }, allDayText: "Celý den" -}); \ No newline at end of file +}); diff --git a/lang/da.js b/lang/da.js index aee468f..7b53aab 100644 --- a/lang/da.js +++ b/lang/da.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("da", { - buttonText: { + defaultButtonText: { month: "Måned", week: "Uge", day: "Dag", list: "Agenda" }, allDayText: "Hele dagen" -}); \ No newline at end of file +}); diff --git a/lang/de.js b/lang/de.js index 9c1ac3a..cc615a7 100644 --- a/lang/de.js +++ b/lang/de.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("de", { - buttonText: { + defaultButtonText: { month: "Monat", week: "Woche", day: "Tag", list: "Terminübersicht" }, allDayText: "Ganztägig" -}); \ No newline at end of file +}); diff --git a/lang/el.js b/lang/el.js index 64e853e..c374530 100644 --- a/lang/el.js +++ b/lang/el.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("el", { - buttonText: { + defaultButtonText: { month: "Μήνας", week: "Εβδομάδα", day: "Ημέρα", list: "Ατζέντα" }, allDayText: "Ολοήμερο" -}); \ No newline at end of file +}); diff --git a/lang/en-gb.js b/lang/en-gb.js index 41fd8a9..9f1d100 100644 --- a/lang/en-gb.js +++ b/lang/en-gb.js @@ -3,4 +3,4 @@ $.fullCalendar.lang("en-gb", { columnFormat: { week: 'ddd D/M' } -}); \ No newline at end of file +}); diff --git a/lang/es.js b/lang/es.js index 1ffe093..0e31993 100644 --- a/lang/es.js +++ b/lang/es.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("es", { - buttonText: { + defaultButtonText: { month: "Mes", week: "Semana", day: "Día", list: "Agenda" }, allDayText: "Todo el día" -}); \ No newline at end of file +}); diff --git a/lang/fa.js b/lang/fa.js index 3570f75..8682f1a 100644 --- a/lang/fa.js +++ b/lang/fa.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("fa", { - buttonText: { + defaultButtonText: { month: "ماه", week: "هفته", day: "روز", list: "برنامه" }, allDayText: "تمام روز" -}); \ No newline at end of file +}); diff --git a/lang/fi.js b/lang/fi.js index 8005690..f1b4761 100644 --- a/lang/fi.js +++ b/lang/fi.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("fi", { - buttonText: { + defaultButtonText: { month: "Kuukausi", week: "Viikko", day: "Päivä", list: "Tapahtumat" }, allDayText: "Koko päivä" -}); \ No newline at end of file +}); diff --git a/lang/fr.js b/lang/fr.js index 6ab62ca..3b49e68 100644 --- a/lang/fr.js +++ b/lang/fr.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("fr", { - buttonText: { + defaultButtonText: { month: "Mois", week: "Semaine", day: "Jour", list: "Mon planning" }, allDayHTML: "Toute la journée" // allDayHTML is discouraged but used here as a hack to get the breaking correct -}); \ No newline at end of file +}); diff --git a/lang/hi.js b/lang/hi.js index bedf3c7..492ecca 100644 --- a/lang/hi.js +++ b/lang/hi.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("hi", { - buttonText: { + defaultButtonText: { month: "महीना", week: "सप्ताह", day: "दिन", list: "कार्यसूची" }, allDayText: "सभी दिन" -}); \ No newline at end of file +}); diff --git a/lang/hr.js b/lang/hr.js index abc5027..294b5a0 100644 --- a/lang/hr.js +++ b/lang/hr.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("hr", { - buttonText: { + defaultButtonText: { month: "Mjesec", week: "Tjedan", day: "Dan", list: "Raspored" }, allDayText: "Cijeli dan" -}); \ No newline at end of file +}); diff --git a/lang/hu.js b/lang/hu.js index 41e9101..3290b35 100644 --- a/lang/hu.js +++ b/lang/hu.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("hu", { - buttonText: { + defaultButtonText: { month: "Hónap", week: "Hét", day: "Nap", list: "Napló" }, allDayText: "Egész nap" -}); \ No newline at end of file +}); diff --git a/lang/in.js b/lang/in.js index 447117e..119732e 100644 --- a/lang/in.js +++ b/lang/in.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("in", { - buttonText: { + defaultButtonText: { month: "Bulan", week: "Minggu", day: "Hari", list: "Agenda" }, allDayText: "Sepanjang hari" -}); \ No newline at end of file +}); diff --git a/lang/it.js b/lang/it.js index 39b0f43..a7c4a7e 100644 --- a/lang/it.js +++ b/lang/it.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("it", { - buttonText: { + defaultButtonText: { month: "Mese", week: "Settimana", day: "Giorno", list: "Agenda" }, allDayText: "Tutto il giorno" -}); \ No newline at end of file +}); diff --git a/lang/iw.js b/lang/iw.js index 3c5d74e..a8c1794 100644 --- a/lang/iw.js +++ b/lang/iw.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("iw", { - buttonText: { + defaultButtonText: { month: "חודש", week: "שבוע", day: "יום", list: "סדר יום" }, allDayText: "כל היום" -}); \ No newline at end of file +}); diff --git a/lang/ja.js b/lang/ja.js index 791eeb7..a0b82f9 100644 --- a/lang/ja.js +++ b/lang/ja.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("ja", { - buttonText: { + defaultButtonText: { month: "月", week: "週", day: "日", list: "予定リスト" }, allDayText: "終日" -}); \ No newline at end of file +}); diff --git a/lang/ko.js b/lang/ko.js index 8011d28..ad5c9c8 100644 --- a/lang/ko.js +++ b/lang/ko.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("ko", { - buttonText: { + defaultButtonText: { month: "월", week: "주", day: "일", list: "일정목록" }, allDayText: "종일" -}); \ No newline at end of file +}); diff --git a/lang/lt.js b/lang/lt.js index 819f1e9..1a2a6a2 100644 --- a/lang/lt.js +++ b/lang/lt.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("lt", { - buttonText: { + defaultButtonText: { month: "Mėnuo", week: "Savaitė", day: "Diena", list: "Darbotvarkė" }, allDayText: "Visą dieną" -}); \ No newline at end of file +}); diff --git a/lang/lv.js b/lang/lv.js index 8b654b0..91ca961 100644 --- a/lang/lv.js +++ b/lang/lv.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("lv", { - buttonText: { + defaultButtonText: { month: "Mēnesis", week: "Nedēļa", day: "Diena", list: "Dienas kārtība" }, allDayText: "Visu dienu" -}); \ No newline at end of file +}); diff --git a/lang/nl.js b/lang/nl.js index 60bdfdd..4231393 100644 --- a/lang/nl.js +++ b/lang/nl.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("nl", { - buttonText: { + defaultButtonText: { month: "Maand", week: "Week", day: "Dag", list: "Agenda" }, allDayText: "Hele dag" -}); \ No newline at end of file +}); diff --git a/lang/no.js b/lang/no.js index b52ea39..e92112d 100644 --- a/lang/no.js +++ b/lang/no.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("no", { - buttonText: { + defaultButtonText: { month: "Måned", week: "Uke", day: "Dag", list: "Agenda" }, allDayText: "Hele dagen" -}); \ No newline at end of file +}); diff --git a/lang/pl.js b/lang/pl.js index 1f45876..1a13435 100644 --- a/lang/pl.js +++ b/lang/pl.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("pl", { - buttonText: { + defaultButtonText: { month: "Miesiąc", week: "Tydzień", day: "Dzień", list: "Plan dnia" }, allDayText: "Cały dzień" -}); \ No newline at end of file +}); diff --git a/lang/pt-br.js b/lang/pt-br.js index 6894c49..5655273 100644 --- a/lang/pt-br.js +++ b/lang/pt-br.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("pt-br", { - buttonText: { + defaultButtonText: { month: "Mês", week: "Semana", day: "Dia", list: "Compromissos" }, allDayText: "dia inteiro" -}); \ No newline at end of file +}); diff --git a/lang/pt.js b/lang/pt.js index 52381c3..0bfaeac 100644 --- a/lang/pt.js +++ b/lang/pt.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("pt", { - buttonText: { + defaultButtonText: { month: "Mês", week: "Semana", day: "Dia", list: "Agenda" }, allDayText: "Todo o dia" -}); \ No newline at end of file +}); diff --git a/lang/ro.js b/lang/ro.js index 7f5b588..a8f8642 100644 --- a/lang/ro.js +++ b/lang/ro.js @@ -1,6 +1,6 @@ $.fullCalendar.lang("ro", { - buttonText: { + defaultButtonText: { prev: "precedentă", // override JQUI's translations, which contains the word "month" next: "următoare", // " month: "Lună", @@ -9,4 +9,4 @@ $.fullCalendar.lang("ro", { list: "Agendă" }, allDayText: "Toată ziua" -}); \ No newline at end of file +}); diff --git a/lang/ru.js b/lang/ru.js index 4508e17..eebfc62 100644 --- a/lang/ru.js +++ b/lang/ru.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("ru", { - buttonText: { + defaultButtonText: { month: "Месяц", week: "Неделя", day: "День", list: "Повестка дня" }, allDayText: "Весь день" -}); \ No newline at end of file +}); diff --git a/lang/sk.js b/lang/sk.js index 8f8d04e..eeadd21 100644 --- a/lang/sk.js +++ b/lang/sk.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("sk", { - buttonText: { + defaultButtonText: { month: "Mesiac", week: "Týždeň", day: "Deň", list: "Rozvrh" }, allDayText: "Celý deň" -}); \ No newline at end of file +}); diff --git a/lang/sl.js b/lang/sl.js index 77ebeae..38f5a62 100644 --- a/lang/sl.js +++ b/lang/sl.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("sl", { - buttonText: { + defaultButtonText: { month: "Mesec", week: "Teden", day: "Dan", list: "Dnevni red" }, allDayText: "Ves dan" -}); \ No newline at end of file +}); diff --git a/lang/sr.js b/lang/sr.js index 43d5f4a..40864a5 100644 --- a/lang/sr.js +++ b/lang/sr.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("sr", { - buttonText: { + defaultButtonText: { month: "Месец", week: "Недеља", day: "Дан", list: "Планер" }, allDayText: "Цео дан" -}); \ No newline at end of file +}); diff --git a/lang/sv.js b/lang/sv.js index b96d10a..75ce338 100644 --- a/lang/sv.js +++ b/lang/sv.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("sv", { - buttonText: { + defaultButtonText: { month: "Månad", week: "Vecka", day: "Dag", list: "Program" }, allDayText: "Heldag" -}); \ No newline at end of file +}); diff --git a/lang/th.js b/lang/th.js index 967df96..4a1c21c 100644 --- a/lang/th.js +++ b/lang/th.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("th", { - buttonText: { + defaultButtonText: { month: "เดือน", week: "สัปดาห์", day: "วัน", list: "แผนงาน" }, allDayText: "ตลอดวัน" -}); \ No newline at end of file +}); diff --git a/lang/tl.js b/lang/tl.js index 5878a0b..a827855 100644 --- a/lang/tl.js +++ b/lang/tl.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("tl", { - buttonText: { + defaultButtonText: { month: "Buwan", week: "Linggo", day: "Araw", list: "Pakay" }, allDayText: "Lahat ng araw" -}); \ No newline at end of file +}); diff --git a/lang/tr.js b/lang/tr.js index 03c76aa..1432f5a 100644 --- a/lang/tr.js +++ b/lang/tr.js @@ -1,6 +1,6 @@ $.fullCalendar.lang("tr", { - buttonText: { + defaultButtonText: { next: "ileri", // override JQUI's, which has a non-closing HTML entity in it month: "Ay", week: "Hafta", @@ -8,4 +8,4 @@ $.fullCalendar.lang("tr", { list: "Ajanda" }, allDayText: "Tüm gün" -}); \ No newline at end of file +}); diff --git a/lang/uk.js b/lang/uk.js index 5e6490a..cb0b117 100644 --- a/lang/uk.js +++ b/lang/uk.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("uk", { - buttonText: { + defaultButtonText: { month: "Місяць", week: "Тиждень", day: "День", list: "Порядок денний" }, allDayText: "Увесь день" -}); \ No newline at end of file +}); diff --git a/lang/vi.js b/lang/vi.js index 4040e9d..0e6bdd4 100644 --- a/lang/vi.js +++ b/lang/vi.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("vi", { - buttonText: { + defaultButtonText: { month: "Tháng", week: "Tuần", day: "Ngày", list: "Lịch biểu" }, allDayText: "Cả ngày" -}); \ No newline at end of file +}); diff --git a/lang/zh-cn.js b/lang/zh-cn.js index 2bd81db..fe65c75 100644 --- a/lang/zh-cn.js +++ b/lang/zh-cn.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("zh-cn", { - buttonText: { + defaultButtonText: { month: "月", week: "周", day: "日", list: "日程" }, allDayText: "全天" -}); \ No newline at end of file +}); diff --git a/lang/zh-tw.js b/lang/zh-tw.js index d7f635f..ced64b7 100644 --- a/lang/zh-tw.js +++ b/lang/zh-tw.js @@ -1,10 +1,10 @@ $.fullCalendar.lang("zh-tw", { - buttonText: { + defaultButtonText: { month: "月", week: "週", day: "天", list: "待辦事項" }, allDayText: "全天" -}); \ No newline at end of file +}); diff --git a/src/Header.js b/src/Header.js index c5e1bc9..1537f83 100644 --- a/src/Header.js +++ b/src/Header.js @@ -72,17 +72,21 @@ function Header(calendar, options) { // smartProperty allows different text per view button (ex: "Agenda Week" vs "Basic Week") var themeIcon = smartProperty(options.themeButtonIcons, buttonName); var normalIcon = smartProperty(options.buttonIcons, buttonName); - var text = smartProperty(options.buttonText, buttonName); + var defaultText = smartProperty(options.defaultButtonText, buttonName); + var customText = smartProperty(options.buttonText, buttonName); var html; - if (themeIcon && options.theme) { + if (customText) { + html = htmlEscape(customText); + } + else if (themeIcon && options.theme) { html = ""; } else if (normalIcon && !options.theme) { html = ""; } else { - html = htmlEscape(text || buttonName); + html = htmlEscape(defaultText || buttonName); } var button = $( diff --git a/src/defaults.js b/src/defaults.js index e84af99..67c1d90 100644 --- a/src/defaults.js +++ b/src/defaults.js @@ -49,7 +49,7 @@ var defaults = { // locale isRTL: false, - buttonText: { + defaultButtonText: { prev: "prev", next: "next", prevYear: "prev year", diff --git a/src/lang.js b/src/lang.js index 20e437d..de1485f 100644 --- a/src/lang.js +++ b/src/lang.js @@ -23,7 +23,7 @@ fc.datepickerLang = function(langCode, datepickerLangCode, options) { 'YYYY[' + options.yearSuffix + '] MMMM' : 'MMMM YYYY[' + options.yearSuffix + ']' }, - buttonText: { + defaultButtonText: { // the translations sometimes wrongly contain HTML entities prev: stripHTMLEntities(options.prevText), next: stripHTMLEntities(options.nextText), diff --git a/src/util.js b/src/util.js index 047ee4d..3b91366 100644 --- a/src/util.js +++ b/src/util.js @@ -159,6 +159,7 @@ function arrayMax(a) { function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object + obj = obj || {}; if (obj[name] !== undefined) { return obj[name]; }