calendar-zh.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // ** I18N
  2. // Calendar ZH language
  3. // Author: muziq, <muziq@sina.com>
  4. // Encoding: GB2312 or GBK
  5. // Distributed under the same terms as the calendar itself.
  6. // full day names
  7. Calendar._DN = new Array("������", "����һ", "���ڶ�", "������", "������",
  8. "������", "������", "������");
  9. // Please note that the following array of short day names (and the same goes
  10. // for short month names, _SMN) isn't absolutely necessary. We give it here
  11. // for exemplification on how one can customize the short day names, but if
  12. // they are simply the first N letters of the full name you can simply say:
  13. //
  14. // Calendar._SDN_len = N; // short day name length
  15. // Calendar._SMN_len = N; // short month name length
  16. //
  17. // If N = 3 then this is not needed either since we assume a value of 3 if not
  18. // present, to be compatible with translation files that were written before
  19. // this feature.
  20. // short day names
  21. Calendar._SDN = new Array("��", "һ", "��", "��", "��", "��", "��", "��");
  22. // full month names
  23. Calendar._MN = new Array("1��", "2��", "3��", "4��", "5��", "6��", "7��",
  24. "8��", "9��", "10��", "11��", "12��");
  25. // short month names
  26. Calendar._SMN = new Array("1��", "2��", "3��", "4��", "5��", "6��", "7��",
  27. "8��", "9��", "10��", "11��", "12��");
  28. // tooltips
  29. Calendar._TT = {};
  30. Calendar._TT["INFO"] = "����";
  31. Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n"
  32. + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n"
  33. + // don't translate this this ;-)
  34. "For latest version visit: http://www.dynarch.com/projects/calendar/\n"
  35. + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details."
  36. + "\n\n" + "ѡ������:\n" + "- ��� \xab, \xbb ��ťѡ�����\n" + "- ��� "
  37. + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a)
  38. + " ��ťѡ���·�\n" + "- �������ϰ�ť�ɴӲ˵��п���ѡ����ݻ��·�";
  39. Calendar._TT["ABOUT_TIME"] = "\n\n" + "ѡ��ʱ��:\n" + "- ���Сʱ����ӿ�ʹ����ֵ��һ\n"
  40. + "- ��סShift����Сʱ����ӿ�ʹ����ֵ��һ\n" + "- ����϶����ɽ��п���ѡ��";
  41. Calendar._TT["PREV_YEAR"] = "��һ�� (��ס���˵�)";
  42. Calendar._TT["PREV_MONTH"] = "��һ�� (��ס���˵�)";
  43. Calendar._TT["GO_TODAY"] = "ת������";
  44. Calendar._TT["NEXT_MONTH"] = "��һ�� (��ס���˵�)";
  45. Calendar._TT["NEXT_YEAR"] = "��һ�� (��ס���˵�)";
  46. Calendar._TT["SEL_DATE"] = "ѡ������";
  47. Calendar._TT["DRAG_TO_MOVE"] = "�϶�";
  48. Calendar._TT["PART_TODAY"] = " (����)";
  49. // the following is to inform that "%s" is to be the first day of week
  50. // %s will be replaced with the day name.
  51. Calendar._TT["DAY_FIRST"] = "�������ʾ%s";
  52. // This may be locale-dependent. It specifies the week-end days, as an array
  53. // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
  54. // means Monday, etc.
  55. Calendar._TT["WEEKEND"] = "0,6";
  56. Calendar._TT["CLOSE"] = "�ر�";
  57. Calendar._TT["TODAY"] = "����";
  58. Calendar._TT["TIME_PART"] = "(Shift-)��������϶��ı�ֵ";
  59. // date formats
  60. Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
  61. Calendar._TT["TT_DATE_FORMAT"] = "%A, %b %e��";
  62. Calendar._TT["WK"] = "��";
  63. Calendar._TT["TIME"] = "ʱ��:";
  64. // --������ڹ����Ĺ�����չ---------------------
  65. /*
  66. * ��չ����Ҫ���ܣ� ����ũ�����ڹ�������ũ�����������������ʾ����
  67. * ����ڼ��յ������жϣ��ѽڼ��յ��������������ʾ������ʾ����
  68. * ����������ʼ����������Ч��ѡ��Ŀ���
  69. */
  70. // =====================================
  71. Calendar.solarTerm = new Array("С��", "��", "����", "��ˮ", "����", "����",
  72. "����", "����", "����", "С��", "â��", "����", "С��", "����", "����",
  73. "����", "��¶", "���", "��¶", "˪��", "����", "Сѩ", "��ѩ", "����")
  74. Calendar.lFestival = new Array("0101 ����", "0115 Ԫ���", "0505 �����",
  75. "0707 ��Ϧ���˽�", "0715 ��Ԫ��", "0815 �����", "0909 ������",
  76. "1208 ���˽�", "1224 С��", "1230 ��Ϧ")
  77. Calendar.sFestival = new Array("0101*Ԫ��", "0214 ���˽�", "0308 ��Ů��",
  78. "0312 ֲ����", "0315 �����Ȩ����", "0401 ���˽�", "0501 �Ͷ���",
  79. "0504 �����", "0512 ��ʿ��", "0601 ��ͯ��", "0929 ���������",
  80. "0701 ������ ��ۻع����", "0801 �����", "0808 ���׽�", "0909 ëϯ��������",
  81. "0910 ��ʦ��", "0928 ���ӵ���", "1001*�����", "1006 ���˽�",
  82. "1024 ���Ϲ���", "1112 ����ɽ����", "1220 ���Żع����", "1225 ʥ����",
  83. "1226 ëϯ����")
  84. // ==============================================
  85. /*
  86. * ��������������Ͷ���Ķ��� ���ũ��, �������ڴ���ũ��������� ����������� .year .month
  87. * .day .isLeap .yearCyl .dayCyl .monCyl
  88. */
  89. function DateLunar(objDate) {
  90. var i, leap = 0, temp = 0
  91. var baseDate = new Date(1900, 0, 31)
  92. var offset = (objDate - baseDate) / 86400000;
  93. this.objDate = objDate;
  94. this.dayCyl = offset + 40
  95. this.monCyl = 14
  96. for (i = 1900; i < 2050 && offset > 0; i++) {
  97. temp = this.lYearDays(i);
  98. offset -= temp
  99. this.monCyl += 12
  100. }
  101. if (offset < 0) {
  102. offset += temp;
  103. i--;
  104. this.monCyl -= 12
  105. }
  106. this.year = i
  107. this.yearCyl = i - 1864
  108. leap = this.leapMonth(i) // ���ĸ���
  109. this.isLeap = false
  110. for (i = 1; i < 13 && offset > 0; i++) {
  111. // ����
  112. if (leap > 0 && i == (leap + 1) && this.isLeap == false) {
  113. --i;
  114. this.isLeap = true;
  115. temp = this.leapDays(this.year);
  116. } else {
  117. temp = this.monthDays(this.year, i);
  118. }
  119. // �������
  120. if (this.isLeap == true && i == (leap + 1))
  121. this.isLeap = false
  122. offset -= temp
  123. if (this.isLeap == false)
  124. this.monCyl++
  125. }
  126. if (offset == 0 && leap > 0 && i == leap + 1)
  127. if (this.isLeap) {
  128. this.isLeap = false;
  129. } else {
  130. this.isLeap = true;
  131. --i;
  132. --this.monCyl;
  133. }
  134. if (offset < 0) {
  135. offset += temp;
  136. --i;
  137. --this.monCyl;
  138. }
  139. this.month = i
  140. this.day = offset + 1
  141. }
  142. DateLunar.prototype.lunarInfo = new Array(0x04bd8, 0x04ae0, 0x0a570, 0x054d5,
  143. 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6,
  144. 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
  145. 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570,
  146. 0x052f2, 0x04970, 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60,
  147. 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0,
  148. 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550,
  149. 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0,
  150. 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950,
  151. 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250,
  152. 0x0d558, 0x0b540, 0x0b5a0, 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0,
  153. 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970,
  154. 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,
  155. 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0,
  156. 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0,
  157. 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52,
  158. 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3,
  159. 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
  160. 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255,
  161. 0x06d20, 0x0ada0)
  162. DateLunar.prototype.Animals = new Array("��", "ţ", "��", "��", "��", "��",
  163. "��", "��", "��", "��", "��", "��");
  164. DateLunar.prototype.Gan = new Array("��", "��", "��", "��", "��", "��", "��",
  165. "��", "��", "��");
  166. DateLunar.prototype.Zhi = new Array("��", "��", "��", "î", "��", "��", "��",
  167. "δ", "��", "��", "��", "��");
  168. // ==== ����ũ�� y���������
  169. DateLunar.prototype.lYearDays = function(y) {
  170. // alert("y = " + y)
  171. var i, sum = 348
  172. for (i = 0x8000; i > 0x8; i >>= 1)
  173. sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0
  174. return (sum + this.leapDays(y))
  175. }
  176. // ==== ����ũ�� y�����µ�����
  177. DateLunar.prototype.leapDays = function(y) {
  178. if (this.leapMonth(y))
  179. return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
  180. else
  181. return (0)
  182. }
  183. // ==== ����ũ�� y�����ĸ��� 1-12 , û�򴫻� 0
  184. DateLunar.prototype.leapMonth = function(y) {
  185. return (this.lunarInfo[y - 1900] & 0xf)
  186. }
  187. // ==== ����ũ�� y��m�µ�������
  188. DateLunar.prototype.monthDays = function(y, m) {
  189. return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
  190. }
  191. // ==== ���� offset ���ظ�֧, 0=����
  192. DateLunar.prototype.cyclical = function() {
  193. // alert("this.objDate.getYear() = "+this.objDate.getYear() +"/n this.year =
  194. // " +this.year )
  195. // var num = this.objDate.getYear() -1900 + 36
  196. var num = this.year - 1900 + 36;
  197. return (this.Gan[num % 10] + this.Zhi[num % 12])
  198. }
  199. /** Returns the month of the day to chinese description.......... */
  200. DateLunar.prototype.chinaDate = function() {
  201. var nStr1 = new Array('��', 'һ', '��', '��', '��', '��', '��', '��', '��',
  202. '��', 'ʮ');
  203. var nStr2 = new Array('��', 'ʮ', 'إ', 'ئ', '��');
  204. var lunarMonth = this.month;
  205. var lunarday = this.day;
  206. var s;
  207. if (lunarMonth > 10) {
  208. s = 'ʮ' + nStr1[lunarMonth - 10]
  209. } else {
  210. s = nStr1[lunarMonth]
  211. }
  212. s += '��'
  213. switch (lunarday) {
  214. case 10 :
  215. s += '��ʮ';
  216. break;
  217. case 20 :
  218. s += '��ʮ';
  219. break;
  220. case 30 :
  221. s += '��ʮ';
  222. break;
  223. default :
  224. s += nStr2[Math.floor(lunarday / 10)];
  225. s += nStr1[lunarday % 10];
  226. }
  227. return (s);
  228. }
  229. DateLunar.prototype.print = function() {
  230. var cl = '<font color="green" STYLE="font-size:9pt;">����';
  231. // ũ��BB'+(cld[d].isLeap?'�� ':' ')+cld[d].lMonth+' �� '+cld[d].lDay+' ��
  232. var tt = this.cyclical() + '�� ' + this.chinaDate();
  233. return (cl + tt + '</font>');
  234. }
  235. // ----------�������ڶ���Ķ������-----------------------------
  236. Date.prototype.getDateLunar = function() {
  237. var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0,
  238. 0);
  239. return new DateLunar(d);
  240. };
  241. Date.prototype.DateLunarPrint = function() {
  242. var DateLunar = this.getDateLunar();
  243. return DateLunar.print();
  244. };
  245. Date.prototype.FestivalPrint = function() {
  246. var objDate = new Date(this.getFullYear(), this.getMonth(), this.getDate(),
  247. 0, 0, 0);
  248. var objDateLunar = this.getDateLunar();
  249. var iYear = objDate.getYear();
  250. var iMonth = objDate.getMonth();
  251. var iDate = objDate.getDate();
  252. var sTermInfo = new Array(0, 21208, 42467, 63836, 85337, 107014, 128867,
  253. 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563,
  254. 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532,
  255. 504758)
  256. var solarTerm = Calendar.solarTerm;
  257. var lDPOS = new Array(3)
  258. var festival = '', solarTerms = '', solarFestival = '', lunarFestival = '', tmp1, tmp2;
  259. for (var i = 0; i < Calendar.lFestival.length; i++) {
  260. if (Calendar.lFestival[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {
  261. tmp1 = Number(RegExp.$1) - objDateLunar.month
  262. tmp2 = Number(RegExp.$2) - objDateLunar.day
  263. if (tmp1 == 0 && tmp2 == 0)
  264. lunarFestival = RegExp.$4
  265. }
  266. }
  267. for (var i = 0; i < Calendar.sFestival.length; i++) {
  268. if (Calendar.sFestival[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/)) {
  269. tmp1 = Number(RegExp.$1) - (iMonth + 1)
  270. tmp2 = Number(RegExp.$2) - iDate
  271. if (tmp1 == 0 && tmp2 == 0)
  272. solarFestival = RegExp.$4
  273. }
  274. }
  275. // ����
  276. tmp1 = new Date((31556925974.7 * (iYear - 1900) + sTermInfo[iMonth * 2 + 1]
  277. * 60000)
  278. + Date.UTC(1900, 0, 6, 2, 5))
  279. tmp2 = tmp1.getUTCDate()
  280. if (tmp2 == iDate)
  281. solarTerms = solarTerm[iMonth * 2 + 1]
  282. tmp1 = new Date((31556925974.7 * (iYear - 1900) + sTermInfo[iMonth * 2]
  283. * 60000)
  284. + Date.UTC(1900, 0, 6, 2, 5))
  285. tmp2 = tmp1.getUTCDate()
  286. if (tmp2 == iDate)
  287. solarTerms = solarTerm[iMonth * 2]
  288. if (solarTerms == '' && solarFestival == '' && lunarFestival == '')
  289. festival = '';
  290. else
  291. festival = '<br><b>�����ǣ�' + solarTerms + ' ' + solarFestival + ' '
  292. + lunarFestival + '</b>';
  293. var cl = '<font color="#FF33FF" STYLE="font-size:9pt;">';
  294. return (cl + festival + '</font>');
  295. };