Преглед изворни кода

allow user-specified buttonText to override buttonIcons

Adam Shaw пре 11 година
родитељ
комит
dda017efe2
44 измењених фајлова са 89 додато и 84 уклоњено
  1. 2 2
      lang/ar.js
  2. 2 2
      lang/bg.js
  3. 2 2
      lang/ca.js
  4. 2 2
      lang/cs.js
  5. 2 2
      lang/da.js
  6. 2 2
      lang/de.js
  7. 2 2
      lang/el.js
  8. 1 1
      lang/en-gb.js
  9. 2 2
      lang/es.js
  10. 2 2
      lang/fa.js
  11. 2 2
      lang/fi.js
  12. 2 2
      lang/fr.js
  13. 2 2
      lang/hi.js
  14. 2 2
      lang/hr.js
  15. 2 2
      lang/hu.js
  16. 2 2
      lang/in.js
  17. 2 2
      lang/it.js
  18. 2 2
      lang/iw.js
  19. 2 2
      lang/ja.js
  20. 2 2
      lang/ko.js
  21. 2 2
      lang/lt.js
  22. 2 2
      lang/lv.js
  23. 2 2
      lang/nl.js
  24. 2 2
      lang/no.js
  25. 2 2
      lang/pl.js
  26. 2 2
      lang/pt-br.js
  27. 2 2
      lang/pt.js
  28. 2 2
      lang/ro.js
  29. 2 2
      lang/ru.js
  30. 2 2
      lang/sk.js
  31. 2 2
      lang/sl.js
  32. 2 2
      lang/sr.js
  33. 2 2
      lang/sv.js
  34. 2 2
      lang/th.js
  35. 2 2
      lang/tl.js
  36. 2 2
      lang/tr.js
  37. 2 2
      lang/uk.js
  38. 2 2
      lang/vi.js
  39. 2 2
      lang/zh-cn.js
  40. 2 2
      lang/zh-tw.js
  41. 7 3
      src/Header.js
  42. 1 1
      src/defaults.js
  43. 1 1
      src/lang.js
  44. 1 0
      src/util.js

+ 2 - 2
lang/ar.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("ar", {
-	buttonText: {
+	defaultButtonText: {
 		month: "شهر",
 		week: "أسبوع",
 		day: "يوم",
 		list: "أجندة"
 	},
 	allDayText: "اليوم كله"
-});
+});

+ 2 - 2
lang/bg.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("bg", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Месец",
 		week: "Седмица",
 		day: "Ден",
 		list: "График"
 	},
 	allDayText: "Цял ден"
-});
+});

+ 2 - 2
lang/ca.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("ca", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mes",
 		week: "Setmana",
 		day: "Dia",
 		list: "Agenda"
 	},
 	allDayText: "Tot el dia"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/da.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("da", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Måned",
 		week: "Uge",
 		day: "Dag",
 		list: "Agenda"
 	},
 	allDayText: "Hele dagen"
-});
+});

+ 2 - 2
lang/de.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("de", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Monat",
 		week: "Woche",
 		day: "Tag",
 		list: "Terminübersicht"
 	},
 	allDayText: "Ganztägig"
-});
+});

+ 2 - 2
lang/el.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("el", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Μήνας",
 		week: "Εβδομάδα",
 		day: "Ημέρα",
 		list: "Ατζέντα"
 	},
 	allDayText: "Ολοήμερο"
-});
+});

+ 1 - 1
lang/en-gb.js

@@ -3,4 +3,4 @@ $.fullCalendar.lang("en-gb", {
 	columnFormat: {
 		week: 'ddd D/M'
 	}
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/fa.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("fa", {
-	buttonText: {
+	defaultButtonText: {
 		month: "ماه",
 		week: "هفته",
 		day: "روز",
 		list: "برنامه"
 	},
 	allDayText: "تمام روز"
-});
+});

+ 2 - 2
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ä"
-});
+});

+ 2 - 2
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
-});
+});

+ 2 - 2
lang/hi.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("hi", {
-	buttonText: {
+	defaultButtonText: {
 		month: "महीना",
 		week: "सप्ताह",
 		day: "दिन",
 		list: "कार्यसूची"
 	},
 	allDayText: "सभी दिन"
-});
+});

+ 2 - 2
lang/hr.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("hr", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mjesec",
 		week: "Tjedan",
 		day: "Dan",
 		list: "Raspored"
 	},
 	allDayText: "Cijeli dan"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/in.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("in", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Bulan",
 		week: "Minggu",
 		day: "Hari",
 		list: "Agenda"
 	},
 	allDayText: "Sepanjang hari"
-});
+});

+ 2 - 2
lang/it.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("it", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mese",
 		week: "Settimana",
 		day: "Giorno",
 		list: "Agenda"
 	},
 	allDayText: "Tutto il giorno"
-});
+});

+ 2 - 2
lang/iw.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("iw", {
-	buttonText: {
+	defaultButtonText: {
 		month: "חודש",
 		week: "שבוע",
 		day: "יום",
 		list: "סדר יום"
 	},
 	allDayText: "כל היום"
-});
+});

+ 2 - 2
lang/ja.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("ja", {
-	buttonText: {
+	defaultButtonText: {
 		month: "月",
 		week: "週",
 		day: "日",
 		list: "予定リスト"
 	},
 	allDayText: "終日"
-});
+});

+ 2 - 2
lang/ko.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("ko", {
-	buttonText: {
+	defaultButtonText: {
 		month: "월",
 		week: "주",
 		day: "일",
 		list: "일정목록"
 	},
 	allDayText: "종일"
-});
+});

+ 2 - 2
lang/lt.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("lt", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mėnuo",
 		week: "Savaitė",
 		day: "Diena",
 		list: "Darbotvarkė"
 	},
 	allDayText: "Visą dieną"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/nl.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("nl", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Maand",
 		week: "Week",
 		day: "Dag",
 		list: "Agenda"
 	},
 	allDayText: "Hele dag"
-});
+});

+ 2 - 2
lang/no.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("no", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Måned",
 		week: "Uke",
 		day: "Dag",
 		list: "Agenda"
 	},
 	allDayText: "Hele dagen"
-});
+});

+ 2 - 2
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ń"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/ru.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("ru", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Месяц",
 		week: "Неделя",
 		day: "День",
 		list: "Повестка дня"
 	},
 	allDayText: "Весь день"
-});
+});

+ 2 - 2
lang/sk.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("sk", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mesiac",
 		week: "Týždeň",
 		day: "Deň",
 		list: "Rozvrh"
 	},
 	allDayText: "Celý deň"
-});
+});

+ 2 - 2
lang/sl.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("sl", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Mesec",
 		week: "Teden",
 		day: "Dan",
 		list: "Dnevni red"
 	},
 	allDayText: "Ves dan"
-});
+});

+ 2 - 2
lang/sr.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("sr", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Месец",
 		week: "Недеља",
 		day: "Дан",
 		list: "Планер"
 	},
 	allDayText: "Цео дан"
-});
+});

+ 2 - 2
lang/sv.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("sv", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Månad",
 		week: "Vecka",
 		day: "Dag",
 		list: "Program"
 	},
 	allDayText: "Heldag"
-});
+});

+ 2 - 2
lang/th.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("th", {
-	buttonText: {
+	defaultButtonText: {
 		month: "เดือน",
 		week: "สัปดาห์",
 		day: "วัน",
 		list: "แผนงาน"
 	},
 	allDayText: "ตลอดวัน"
-});
+});

+ 2 - 2
lang/tl.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("tl", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Buwan",
 		week: "Linggo",
 		day: "Araw",
 		list: "Pakay"
 	},
 	allDayText: "Lahat ng araw"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/uk.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("uk", {
-	buttonText: {
+	defaultButtonText: {
 		month: "Місяць",
 		week: "Тиждень",
 		day: "День",
 		list: "Порядок денний"
 	},
 	allDayText: "Увесь день"
-});
+});

+ 2 - 2
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"
-});
+});

+ 2 - 2
lang/zh-cn.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("zh-cn", {
-	buttonText: {
+	defaultButtonText: {
 		month: "月",
 		week: "周",
 		day: "日",
 		list: "日程"
 	},
 	allDayText: "全天"
-});
+});

+ 2 - 2
lang/zh-tw.js

@@ -1,10 +1,10 @@
 
 $.fullCalendar.lang("zh-tw", {
-	buttonText: {
+	defaultButtonText: {
 		month: "月",
 		week: "週",
 		day: "天",
 		list: "待辦事項"
 	},
 	allDayText: "全天"
-});
+});

+ 7 - 3
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 = "<span class='ui-icon ui-icon-" + themeIcon + "'></span>";
 							}
 							else if (normalIcon && !options.theme) {
 								html = "<span class='fc-icon fc-icon-" + normalIcon + "'></span>";
 							}
 							else {
-								html = htmlEscape(text || buttonName);
+								html = htmlEscape(defaultText || buttonName);
 							}
 
 							var button = $(

+ 1 - 1
src/defaults.js

@@ -49,7 +49,7 @@ var defaults = {
 	
 	// locale
 	isRTL: false,
-	buttonText: {
+	defaultButtonText: {
 		prev: "prev",
 		next: "next",
 		prevYear: "prev year",

+ 1 - 1
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),

+ 1 - 0
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];
 	}