gettext 1.0.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. data/COPYING +55 -0
  2. data/COPYING.ja +51 -0
  3. data/ChangeLog +490 -0
  4. data/NEWS +98 -0
  5. data/README +113 -0
  6. data/README.ja +115 -0
  7. data/Rakefile +169 -0
  8. data/bin/rgettext +22 -0
  9. data/bin/rmsgfmt +22 -0
  10. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  11. data/data/locale/de/LC_MESSAGES/rmsgfmt.mo +0 -0
  12. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  13. data/data/locale/es/LC_MESSAGES/rmsgfmt.mo +0 -0
  14. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  15. data/data/locale/fr/LC_MESSAGES/rmsgfmt.mo +0 -0
  16. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  17. data/data/locale/it/LC_MESSAGES/rmsgfmt.mo +0 -0
  18. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/ja/LC_MESSAGES/rmsgfmt.mo +0 -0
  20. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/ko/LC_MESSAGES/rmsgfmt.mo +0 -0
  22. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/pt_BR/LC_MESSAGES/rmsgfmt.mo +0 -0
  24. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/sv/LC_MESSAGES/rmsgfmt.mo +0 -0
  26. data/ext/gettext/gettext/MANIFEST +3 -0
  27. data/ext/gettext/gettext/Makefile +145 -0
  28. data/ext/gettext/gettext/_locale-i386-mswin32.def +2 -0
  29. data/ext/gettext/gettext/_locale.c +86 -0
  30. data/ext/gettext/gettext/_locale.exp +0 -0
  31. data/ext/gettext/gettext/_locale.lib +0 -0
  32. data/ext/gettext/gettext/_locale.obj +0 -0
  33. data/ext/gettext/gettext/_locale.pdb +0 -0
  34. data/ext/gettext/gettext/_locale.so +0 -0
  35. data/ext/gettext/gettext/extconf.rb +20 -0
  36. data/ext/gettext/gettext/mkmf.log +16 -0
  37. data/ext/gettext/gettext/vc70.pdb +0 -0
  38. data/gettext-1.0.0-mswin32.gem +0 -0
  39. data/lib/_locale.so +0 -0
  40. data/lib/gettext.rb +127 -0
  41. data/lib/gettext/cgi.rb +83 -0
  42. data/lib/gettext/container.rb +30 -0
  43. data/lib/gettext/erb.rb +28 -0
  44. data/lib/gettext/iconv.rb +80 -0
  45. data/lib/gettext/locale.rb +71 -0
  46. data/lib/gettext/locale_default.rb +35 -0
  47. data/lib/gettext/locale_table_win32.rb +192 -0
  48. data/lib/gettext/locale_win32.rb +35 -0
  49. data/lib/gettext/mo.rb +262 -0
  50. data/lib/gettext/parser/erb.rb +34 -0
  51. data/lib/gettext/parser/glade.rb +98 -0
  52. data/lib/gettext/parser/ruby.rb +211 -0
  53. data/lib/gettext/rails.rb +40 -0
  54. data/lib/gettext/rgettext.rb +181 -0
  55. data/lib/gettext/rmsgfmt.rb +363 -0
  56. data/lib/gettext/textdomain.rb +168 -0
  57. data/lib/gettext/version.rb +12 -0
  58. data/po/de/rgettext.po +49 -0
  59. data/po/de/rmsgfmt.po +45 -0
  60. data/po/es/rgettext.po +47 -0
  61. data/po/es/rmsgfmt.po +43 -0
  62. data/po/fr/rgettext.po +47 -0
  63. data/po/fr/rmsgfmt.po +43 -0
  64. data/po/it/rgettext.po +47 -0
  65. data/po/it/rmsgfmt.po +44 -0
  66. data/po/ja/rgettext.po +49 -0
  67. data/po/ja/rmsgfmt.po +43 -0
  68. data/po/ko/rgettext.po +46 -0
  69. data/po/ko/rmsgfmt.po +40 -0
  70. data/po/pt_BR/rgettext.po +47 -0
  71. data/po/pt_BR/rmsgfmt.po +42 -0
  72. data/po/rgettext.pot +45 -0
  73. data/po/rmsgfmt.pot +40 -0
  74. data/po/sv/rgettext.po +48 -0
  75. data/po/sv/rmsgfmt.po +43 -0
  76. data/post-setup.rb +12 -0
  77. data/pre-setup.rb +12 -0
  78. data/samples/README +20 -0
  79. data/samples/cgi/README +43 -0
  80. data/samples/cgi/Rakefile +9 -0
  81. data/samples/cgi/cookie.cgi +57 -0
  82. data/samples/cgi/gettext.css +116 -0
  83. data/samples/cgi/helloerb.rhtml +27 -0
  84. data/samples/cgi/helloerb1.cgi +47 -0
  85. data/samples/cgi/helloerb2.cgi +41 -0
  86. data/samples/cgi/hellolib.rb +21 -0
  87. data/samples/cgi/http.rb +54 -0
  88. data/samples/cgi/index.cgi +104 -0
  89. data/samples/cgi/locale/de/LC_MESSAGES/helloerb1.mo +0 -0
  90. data/samples/cgi/locale/de/LC_MESSAGES/helloerb2.mo +0 -0
  91. data/samples/cgi/locale/de/LC_MESSAGES/hellolib.mo +0 -0
  92. data/samples/cgi/locale/de/LC_MESSAGES/main.mo +0 -0
  93. data/samples/cgi/locale/es/LC_MESSAGES/helloerb1.mo +0 -0
  94. data/samples/cgi/locale/es/LC_MESSAGES/helloerb2.mo +0 -0
  95. data/samples/cgi/locale/es/LC_MESSAGES/hellolib.mo +0 -0
  96. data/samples/cgi/locale/es/LC_MESSAGES/main.mo +0 -0
  97. data/samples/cgi/locale/fr/LC_MESSAGES/helloerb1.mo +0 -0
  98. data/samples/cgi/locale/fr/LC_MESSAGES/helloerb2.mo +0 -0
  99. data/samples/cgi/locale/fr/LC_MESSAGES/hellolib.mo +0 -0
  100. data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
  101. data/samples/cgi/locale/it/LC_MESSAGES/helloerb1.mo +0 -0
  102. data/samples/cgi/locale/it/LC_MESSAGES/helloerb2.mo +0 -0
  103. data/samples/cgi/locale/it/LC_MESSAGES/hellolib.mo +0 -0
  104. data/samples/cgi/locale/it/LC_MESSAGES/main.mo +0 -0
  105. data/samples/cgi/locale/ja/LC_MESSAGES/helloerb1.mo +0 -0
  106. data/samples/cgi/locale/ja/LC_MESSAGES/helloerb2.mo +0 -0
  107. data/samples/cgi/locale/ja/LC_MESSAGES/hellolib.mo +0 -0
  108. data/samples/cgi/locale/ja/LC_MESSAGES/main.mo +0 -0
  109. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
  110. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
  111. data/samples/cgi/locale/ko/LC_MESSAGES/hellolib.mo +0 -0
  112. data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
  113. data/samples/cgi/other.rhtml +20 -0
  114. data/samples/cgi/po/de/helloerb1.po +60 -0
  115. data/samples/cgi/po/de/helloerb2.po +52 -0
  116. data/samples/cgi/po/de/hellolib.po +23 -0
  117. data/samples/cgi/po/de/main.po +76 -0
  118. data/samples/cgi/po/es/helloerb1.po +59 -0
  119. data/samples/cgi/po/es/helloerb2.po +50 -0
  120. data/samples/cgi/po/es/hellolib.po +22 -0
  121. data/samples/cgi/po/es/main.po +74 -0
  122. data/samples/cgi/po/fr/helloerb1.po +59 -0
  123. data/samples/cgi/po/fr/helloerb2.po +51 -0
  124. data/samples/cgi/po/fr/hellolib.po +22 -0
  125. data/samples/cgi/po/fr/main.po +75 -0
  126. data/samples/cgi/po/helloerb1.pot +60 -0
  127. data/samples/cgi/po/helloerb2.pot +52 -0
  128. data/samples/cgi/po/hellolib.pot +23 -0
  129. data/samples/cgi/po/it/helloerb1.po +61 -0
  130. data/samples/cgi/po/it/helloerb2.po +52 -0
  131. data/samples/cgi/po/it/hellolib.po +24 -0
  132. data/samples/cgi/po/it/main.po +76 -0
  133. data/samples/cgi/po/ja/helloerb1.po +59 -0
  134. data/samples/cgi/po/ja/helloerb2.po +52 -0
  135. data/samples/cgi/po/ja/hellolib.po +23 -0
  136. data/samples/cgi/po/ja/main.po +76 -0
  137. data/samples/cgi/po/ko/helloerb1.po +58 -0
  138. data/samples/cgi/po/ko/helloerb2.po +52 -0
  139. data/samples/cgi/po/ko/hellolib.po +22 -0
  140. data/samples/cgi/po/ko/main.po +74 -0
  141. data/samples/cgi/po/main.pot +76 -0
  142. data/samples/cgi/ruby.bat +4 -0
  143. data/samples/hello.rb +12 -0
  144. data/samples/hello2.rb +15 -0
  145. data/samples/hello_noop.rb +18 -0
  146. data/samples/hello_plural.rb +15 -0
  147. data/samples/hello_textdomain.rb +12 -0
  148. data/samples/helloglade2.glade +70 -0
  149. data/samples/helloglade2.rb +24 -0
  150. data/samples/hellogtk.rb +26 -0
  151. data/samples/hellogtk2.rb +28 -0
  152. data/samples/hellotk.rb +18 -0
  153. data/samples/locale/de/LC_MESSAGES/hello.mo +0 -0
  154. data/samples/locale/de/LC_MESSAGES/hello2.mo +0 -0
  155. data/samples/locale/de/LC_MESSAGES/hello_noop.mo +0 -0
  156. data/samples/locale/de/LC_MESSAGES/hello_plural.mo +0 -0
  157. data/samples/locale/de/LC_MESSAGES/helloglade2.mo +0 -0
  158. data/samples/locale/de/LC_MESSAGES/hellogtk.mo +0 -0
  159. data/samples/locale/de/LC_MESSAGES/hellotk.mo +0 -0
  160. data/samples/locale/es/LC_MESSAGES/hello.mo +0 -0
  161. data/samples/locale/es/LC_MESSAGES/hello2.mo +0 -0
  162. data/samples/locale/es/LC_MESSAGES/hello_noop.mo +0 -0
  163. data/samples/locale/es/LC_MESSAGES/hello_plural.mo +0 -0
  164. data/samples/locale/es/LC_MESSAGES/helloglade2.mo +0 -0
  165. data/samples/locale/es/LC_MESSAGES/hellogtk.mo +0 -0
  166. data/samples/locale/es/LC_MESSAGES/hellotk.mo +0 -0
  167. data/samples/locale/fr/LC_MESSAGES/hello.mo +0 -0
  168. data/samples/locale/fr/LC_MESSAGES/hello2.mo +0 -0
  169. data/samples/locale/fr/LC_MESSAGES/hello_noop.mo +0 -0
  170. data/samples/locale/fr/LC_MESSAGES/hello_plural.mo +0 -0
  171. data/samples/locale/fr/LC_MESSAGES/helloglade2.mo +0 -0
  172. data/samples/locale/fr/LC_MESSAGES/hellogtk.mo +0 -0
  173. data/samples/locale/fr/LC_MESSAGES/hellotk.mo +0 -0
  174. data/samples/locale/it/LC_MESSAGES/hello.mo +0 -0
  175. data/samples/locale/it/LC_MESSAGES/hello2.mo +0 -0
  176. data/samples/locale/it/LC_MESSAGES/hello_noop.mo +0 -0
  177. data/samples/locale/it/LC_MESSAGES/hello_plural.mo +0 -0
  178. data/samples/locale/it/LC_MESSAGES/helloglade2.mo +0 -0
  179. data/samples/locale/it/LC_MESSAGES/hellogtk.mo +0 -0
  180. data/samples/locale/it/LC_MESSAGES/hellotk.mo +0 -0
  181. data/samples/locale/ja/LC_MESSAGES/hello.mo +0 -0
  182. data/samples/locale/ja/LC_MESSAGES/hello2.mo +0 -0
  183. data/samples/locale/ja/LC_MESSAGES/hello_noop.mo +0 -0
  184. data/samples/locale/ja/LC_MESSAGES/hello_plural.mo +0 -0
  185. data/samples/locale/ja/LC_MESSAGES/helloglade2.mo +0 -0
  186. data/samples/locale/ja/LC_MESSAGES/hellogtk.mo +0 -0
  187. data/samples/locale/ja/LC_MESSAGES/hellotk.mo +0 -0
  188. data/samples/locale/ko/LC_MESSAGES/hello.mo +0 -0
  189. data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
  190. data/samples/locale/ko/LC_MESSAGES/hello_noop.mo +0 -0
  191. data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
  192. data/samples/locale/ko/LC_MESSAGES/helloglade2.mo +0 -0
  193. data/samples/locale/ko/LC_MESSAGES/hellogtk.mo +0 -0
  194. data/samples/locale/ko/LC_MESSAGES/hellotk.mo +0 -0
  195. data/samples/locale/pt_BR/LC_MESSAGES/hello.mo +0 -0
  196. data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
  197. data/samples/locale/pt_BR/LC_MESSAGES/hello_noop.mo +0 -0
  198. data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
  199. data/samples/locale/pt_BR/LC_MESSAGES/helloglade2.mo +0 -0
  200. data/samples/locale/pt_BR/LC_MESSAGES/hellogtk.mo +0 -0
  201. data/samples/locale/pt_BR/LC_MESSAGES/hellotk.mo +0 -0
  202. data/samples/locale/sv/LC_MESSAGES/hello.mo +0 -0
  203. data/samples/locale/sv/LC_MESSAGES/hello2.mo +0 -0
  204. data/samples/locale/sv/LC_MESSAGES/hello_noop.mo +0 -0
  205. data/samples/locale/sv/LC_MESSAGES/hello_plural.mo +0 -0
  206. data/samples/locale/sv/LC_MESSAGES/helloglade2.mo +0 -0
  207. data/samples/locale/sv/LC_MESSAGES/hellogtk.mo +0 -0
  208. data/samples/locale/sv/LC_MESSAGES/hellotk.mo +0 -0
  209. data/samples/makemo.rb +3 -0
  210. data/samples/po/de/hello.po +20 -0
  211. data/samples/po/de/hello2.po +28 -0
  212. data/samples/po/de/hello_noop.po +24 -0
  213. data/samples/po/de/hello_plural.po +22 -0
  214. data/samples/po/de/helloglade2.po +27 -0
  215. data/samples/po/de/hellogtk.po +20 -0
  216. data/samples/po/de/hellotk.po +20 -0
  217. data/samples/po/es/hello.po +21 -0
  218. data/samples/po/es/hello2.po +28 -0
  219. data/samples/po/es/hello_noop.po +24 -0
  220. data/samples/po/es/hello_plural.po +23 -0
  221. data/samples/po/es/helloglade2.po +28 -0
  222. data/samples/po/es/hellogtk.po +20 -0
  223. data/samples/po/es/hellotk.po +20 -0
  224. data/samples/po/fr/hello.po +18 -0
  225. data/samples/po/fr/hello2.po +26 -0
  226. data/samples/po/fr/hello_noop.po +22 -0
  227. data/samples/po/fr/hello_plural.po +21 -0
  228. data/samples/po/fr/helloglade2.po +27 -0
  229. data/samples/po/fr/hellogtk.po +18 -0
  230. data/samples/po/fr/hellotk.po +18 -0
  231. data/samples/po/hello.pot +20 -0
  232. data/samples/po/hello2.pot +28 -0
  233. data/samples/po/hello_noop.pot +24 -0
  234. data/samples/po/hello_plural.pot +22 -0
  235. data/samples/po/helloglade2.pot +27 -0
  236. data/samples/po/hellogtk.pot +20 -0
  237. data/samples/po/hellotk.pot +20 -0
  238. data/samples/po/it/hello.po +20 -0
  239. data/samples/po/it/hello2.po +28 -0
  240. data/samples/po/it/hello_noop.po +24 -0
  241. data/samples/po/it/hello_plural.po +24 -0
  242. data/samples/po/it/helloglade2.po +28 -0
  243. data/samples/po/it/hellogtk.po +21 -0
  244. data/samples/po/it/hellotk.po +21 -0
  245. data/samples/po/ja/hello.po +20 -0
  246. data/samples/po/ja/hello2.po +28 -0
  247. data/samples/po/ja/hello_noop.po +23 -0
  248. data/samples/po/ja/hello_plural.po +22 -0
  249. data/samples/po/ja/helloglade2.po +26 -0
  250. data/samples/po/ja/hellogtk.po +19 -0
  251. data/samples/po/ja/hellotk.po +19 -0
  252. data/samples/po/ko/hello.po +19 -0
  253. data/samples/po/ko/hello2.po +27 -0
  254. data/samples/po/ko/hello_noop.po +23 -0
  255. data/samples/po/ko/hello_plural.po +23 -0
  256. data/samples/po/ko/helloglade2.po +29 -0
  257. data/samples/po/ko/hellogtk.po +19 -0
  258. data/samples/po/ko/hellotk.po +20 -0
  259. data/samples/po/pt_BR/hello.po +20 -0
  260. data/samples/po/pt_BR/hello2.po +28 -0
  261. data/samples/po/pt_BR/hello_noop.po +24 -0
  262. data/samples/po/pt_BR/hello_plural.po +23 -0
  263. data/samples/po/pt_BR/helloglade2.po +28 -0
  264. data/samples/po/pt_BR/hellogtk.po +20 -0
  265. data/samples/po/pt_BR/hellotk.po +20 -0
  266. data/samples/po/sv/hello.po +20 -0
  267. data/samples/po/sv/hello2.po +28 -0
  268. data/samples/po/sv/hello_noop.po +24 -0
  269. data/samples/po/sv/hello_plural.po +23 -0
  270. data/samples/po/sv/helloglade2.po +28 -0
  271. data/samples/po/sv/hellogtk.po +20 -0
  272. data/samples/po/sv/hellotk.po +20 -0
  273. data/samples/rails/README +79 -0
  274. data/samples/rails/Rakefile +212 -0
  275. data/samples/rails/app/controllers/application.rb +37 -0
  276. data/samples/rails/app/controllers/blog_controller.rb +62 -0
  277. data/samples/rails/app/helpers/application_helper.rb +3 -0
  278. data/samples/rails/app/helpers/blog_helper.rb +61 -0
  279. data/samples/rails/app/models/article.rb +2 -0
  280. data/samples/rails/app/views/blog/_form.rhtml +25 -0
  281. data/samples/rails/app/views/blog/edit.rhtml +22 -0
  282. data/samples/rails/app/views/blog/list.rhtml +30 -0
  283. data/samples/rails/app/views/blog/new.rhtml +21 -0
  284. data/samples/rails/app/views/blog/show.rhtml +18 -0
  285. data/samples/rails/app/views/layouts/blog.rhtml +36 -0
  286. data/samples/rails/config/database.yml +32 -0
  287. data/samples/rails/config/environment.rb +88 -0
  288. data/samples/rails/config/environments/development.rb +14 -0
  289. data/samples/rails/config/environments/production.rb +8 -0
  290. data/samples/rails/config/environments/test.rb +17 -0
  291. data/samples/rails/config/routes.rb +19 -0
  292. data/samples/rails/db/mysql.sql +8 -0
  293. data/samples/rails/db/postgresql.sql +7 -0
  294. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  295. data/samples/rails/locale/de/LC_MESSAGES/lang_helper.mo +0 -0
  296. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  297. data/samples/rails/locale/es/LC_MESSAGES/lang_helper.mo +0 -0
  298. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  299. data/samples/rails/locale/fr/LC_MESSAGES/lang_helper.mo +0 -0
  300. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  301. data/samples/rails/locale/ja/LC_MESSAGES/lang_helper.mo +0 -0
  302. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  303. data/samples/rails/locale/ko/LC_MESSAGES/lang_helper.mo +0 -0
  304. data/samples/rails/log/development.log +378 -0
  305. data/samples/rails/po/blog.pot +90 -0
  306. data/samples/rails/po/de/blog.po +91 -0
  307. data/samples/rails/po/de/lang_helper.po +28 -0
  308. data/samples/rails/po/es/blog.po +90 -0
  309. data/samples/rails/po/es/lang_helper.po +28 -0
  310. data/samples/rails/po/fr/blog.po +89 -0
  311. data/samples/rails/po/fr/lang_helper.po +27 -0
  312. data/samples/rails/po/ja/blog.po +89 -0
  313. data/samples/rails/po/ja/lang_helper.po +28 -0
  314. data/samples/rails/po/ko/blog.po +87 -0
  315. data/samples/rails/po/ko/lang_helper.po +26 -0
  316. data/samples/rails/po/lang_helper.pot +28 -0
  317. data/samples/rails/public/404.html +8 -0
  318. data/samples/rails/public/500.html +8 -0
  319. data/samples/rails/public/dispatch.cgi +10 -0
  320. data/samples/rails/public/dispatch.fcgi +24 -0
  321. data/samples/rails/public/dispatch.rb +10 -0
  322. data/samples/rails/public/favicon.ico +0 -0
  323. data/samples/rails/public/index.html +78 -0
  324. data/samples/rails/public/javascripts/controls.js +446 -0
  325. data/samples/rails/public/javascripts/dragdrop.js +537 -0
  326. data/samples/rails/public/javascripts/effects.js +612 -0
  327. data/samples/rails/public/javascripts/prototype.js +1038 -0
  328. data/samples/rails/public/stylesheets/blog.css +132 -0
  329. data/samples/rails/public/stylesheets/scaffold.css +74 -0
  330. data/samples/rails/script/benchmarker +19 -0
  331. data/samples/rails/script/breakpointer +4 -0
  332. data/samples/rails/script/console +23 -0
  333. data/samples/rails/script/destroy +7 -0
  334. data/samples/rails/script/generate +7 -0
  335. data/samples/rails/script/profiler +34 -0
  336. data/samples/rails/script/runner +29 -0
  337. data/samples/rails/script/server +49 -0
  338. data/samples/rails/test/fixtures/articles.yml +5 -0
  339. data/samples/rails/test/functional/blog_controller_test.rb +88 -0
  340. data/samples/rails/test/test_helper.rb +26 -0
  341. data/samples/rails/test/unit/article_test.rb +14 -0
  342. data/samples/rails/vendor/lang_helper.rb +49 -0
  343. data/setup.rb +1360 -0
  344. data/src/rmsgfmt.ry +233 -0
  345. data/test/README +10 -0
  346. data/test/gettext_runner.rb +18 -0
  347. data/test/gettext_test.rb +202 -0
  348. data/test/gettext_test_parser.rb +80 -0
  349. data/test/locale/cr/LC_MESSAGES/plural.mo +0 -0
  350. data/test/locale/da/LC_MESSAGES/plural.mo +0 -0
  351. data/test/locale/da/LC_MESSAGES/plural_error.mo +0 -0
  352. data/test/locale/fr/LC_MESSAGES/plural.mo +0 -0
  353. data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
  354. data/test/locale/fr/LC_MESSAGES/test1.mo +0 -0
  355. data/test/locale/fr/LC_MESSAGES/test2.mo +0 -0
  356. data/test/locale/ir/LC_MESSAGES/plural.mo +0 -0
  357. data/test/locale/ja/LC_MESSAGES/plural.mo +0 -0
  358. data/test/locale/ja/LC_MESSAGES/plural_error.mo +0 -0
  359. data/test/locale/ja/LC_MESSAGES/test1.mo +0 -0
  360. data/test/locale/ja/LC_MESSAGES/test2.mo +0 -0
  361. data/test/locale/ja/LC_MESSAGES/test_rubyparser.mo +0 -0
  362. data/test/locale/ja/LC_MESSAGES/test_sgettext.mo +0 -0
  363. data/test/locale/la/LC_MESSAGES/plural.mo +0 -0
  364. data/test/locale/li/LC_MESSAGES/plural.mo +0 -0
  365. data/test/locale/po/LC_MESSAGES/plural.mo +0 -0
  366. data/test/locale/sl/LC_MESSAGES/plural.mo +0 -0
  367. data/test/po/cr/plural.po +23 -0
  368. data/test/po/da/plural.po +22 -0
  369. data/test/po/da/plural_error.po +20 -0
  370. data/test/po/fr/plural.po +22 -0
  371. data/test/po/fr/plural_error.po +19 -0
  372. data/test/po/fr/test1.po +23 -0
  373. data/test/po/fr/test2.po +19 -0
  374. data/test/po/ir/plural.po +23 -0
  375. data/test/po/ja/plural.po +22 -0
  376. data/test/po/ja/plural_error.po +20 -0
  377. data/test/po/ja/test1.po +23 -0
  378. data/test/po/ja/test2.po +19 -0
  379. data/test/po/ja/test_rubyparser.po +43 -0
  380. data/test/po/ja/test_sgettext.po +47 -0
  381. data/test/po/la/plural.po +23 -0
  382. data/test/po/li/plural.po +23 -0
  383. data/test/po/po/plural.po +23 -0
  384. data/test/po/sl/plural.po +24 -0
  385. data/test/test.sh +7 -0
  386. data/test/test_erb.rhtml +15 -0
  387. data/test/test_gladeparser.glade +183 -0
  388. data/test/test_rubyparser.rb +77 -0
  389. data/test/test_rubyparser_n.rb +66 -0
  390. data/test/test_sgettext.rb +48 -0
  391. data/test/testlib1.rb +20 -0
  392. data/test/testlib2.rb +11 -0
  393. data/test/testlib3.rb +12 -0
  394. data/test/testlib4.rb +11 -0
  395. metadata +589 -0
@@ -0,0 +1,1038 @@
1
+ /* Prototype JavaScript framework, version 1.3.1
2
+ * (c) 2005 Sam Stephenson <sam@conio.net>
3
+ *
4
+ * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
5
+ * against the source tree, available from the Prototype darcs repository.
6
+ *
7
+ * Prototype is freely distributable under the terms of an MIT-style license.
8
+ *
9
+ * For details, see the Prototype web site: http://prototype.conio.net/
10
+ *
11
+ /*--------------------------------------------------------------------------*/
12
+
13
+ var Prototype = {
14
+ Version: '1.3.1',
15
+ emptyFunction: function() {}
16
+ }
17
+
18
+ var Class = {
19
+ create: function() {
20
+ return function() {
21
+ this.initialize.apply(this, arguments);
22
+ }
23
+ }
24
+ }
25
+
26
+ var Abstract = new Object();
27
+
28
+ Object.extend = function(destination, source) {
29
+ for (property in source) {
30
+ destination[property] = source[property];
31
+ }
32
+ return destination;
33
+ }
34
+
35
+ Object.prototype.extend = function(object) {
36
+ return Object.extend.apply(this, [this, object]);
37
+ }
38
+
39
+ Function.prototype.bind = function(object) {
40
+ var __method = this;
41
+ return function() {
42
+ __method.apply(object, arguments);
43
+ }
44
+ }
45
+
46
+ Function.prototype.bindAsEventListener = function(object) {
47
+ var __method = this;
48
+ return function(event) {
49
+ __method.call(object, event || window.event);
50
+ }
51
+ }
52
+
53
+ Number.prototype.toColorPart = function() {
54
+ var digits = this.toString(16);
55
+ if (this < 16) return '0' + digits;
56
+ return digits;
57
+ }
58
+
59
+ var Try = {
60
+ these: function() {
61
+ var returnValue;
62
+
63
+ for (var i = 0; i < arguments.length; i++) {
64
+ var lambda = arguments[i];
65
+ try {
66
+ returnValue = lambda();
67
+ break;
68
+ } catch (e) {}
69
+ }
70
+
71
+ return returnValue;
72
+ }
73
+ }
74
+
75
+ /*--------------------------------------------------------------------------*/
76
+
77
+ var PeriodicalExecuter = Class.create();
78
+ PeriodicalExecuter.prototype = {
79
+ initialize: function(callback, frequency) {
80
+ this.callback = callback;
81
+ this.frequency = frequency;
82
+ this.currentlyExecuting = false;
83
+
84
+ this.registerCallback();
85
+ },
86
+
87
+ registerCallback: function() {
88
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
89
+ },
90
+
91
+ onTimerEvent: function() {
92
+ if (!this.currentlyExecuting) {
93
+ try {
94
+ this.currentlyExecuting = true;
95
+ this.callback();
96
+ } finally {
97
+ this.currentlyExecuting = false;
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ /*--------------------------------------------------------------------------*/
104
+
105
+ function $() {
106
+ var elements = new Array();
107
+
108
+ for (var i = 0; i < arguments.length; i++) {
109
+ var element = arguments[i];
110
+ if (typeof element == 'string')
111
+ element = document.getElementById(element);
112
+
113
+ if (arguments.length == 1)
114
+ return element;
115
+
116
+ elements.push(element);
117
+ }
118
+
119
+ return elements;
120
+ }
121
+
122
+ if (!Array.prototype.push) {
123
+ Array.prototype.push = function() {
124
+ var startLength = this.length;
125
+ for (var i = 0; i < arguments.length; i++)
126
+ this[startLength + i] = arguments[i];
127
+ return this.length;
128
+ }
129
+ }
130
+
131
+ if (!Function.prototype.apply) {
132
+ // Based on code from http://www.youngpup.net/
133
+ Function.prototype.apply = function(object, parameters) {
134
+ var parameterStrings = new Array();
135
+ if (!object) object = window;
136
+ if (!parameters) parameters = new Array();
137
+
138
+ for (var i = 0; i < parameters.length; i++)
139
+ parameterStrings[i] = 'parameters[' + i + ']';
140
+
141
+ object.__apply__ = this;
142
+ var result = eval('object.__apply__(' +
143
+ parameterStrings[i].join(', ') + ')');
144
+ object.__apply__ = null;
145
+
146
+ return result;
147
+ }
148
+ }
149
+
150
+ String.prototype.extend({
151
+ stripTags: function() {
152
+ return this.replace(/<\/?[^>]+>/gi, '');
153
+ },
154
+
155
+ escapeHTML: function() {
156
+ var div = document.createElement('div');
157
+ var text = document.createTextNode(this);
158
+ div.appendChild(text);
159
+ return div.innerHTML;
160
+ },
161
+
162
+ unescapeHTML: function() {
163
+ var div = document.createElement('div');
164
+ div.innerHTML = this.stripTags();
165
+ return div.childNodes[0].nodeValue;
166
+ }
167
+ });
168
+
169
+ var Ajax = {
170
+ getTransport: function() {
171
+ return Try.these(
172
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
173
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')},
174
+ function() {return new XMLHttpRequest()}
175
+ ) || false;
176
+ }
177
+ }
178
+
179
+ Ajax.Base = function() {};
180
+ Ajax.Base.prototype = {
181
+ setOptions: function(options) {
182
+ this.options = {
183
+ method: 'post',
184
+ asynchronous: true,
185
+ parameters: ''
186
+ }.extend(options || {});
187
+ },
188
+
189
+ responseIsSuccess: function() {
190
+ return this.transport.status == undefined
191
+ || this.transport.status == 0
192
+ || (this.transport.status >= 200 && this.transport.status < 300);
193
+ },
194
+
195
+ responseIsFailure: function() {
196
+ return !this.responseIsSuccess();
197
+ }
198
+ }
199
+
200
+ Ajax.Request = Class.create();
201
+ Ajax.Request.Events =
202
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
203
+
204
+ Ajax.Request.prototype = (new Ajax.Base()).extend({
205
+ initialize: function(url, options) {
206
+ this.transport = Ajax.getTransport();
207
+ this.setOptions(options);
208
+ this.request(url);
209
+ },
210
+
211
+ request: function(url) {
212
+ var parameters = this.options.parameters || '';
213
+ if (parameters.length > 0) parameters += '&_=';
214
+
215
+ try {
216
+ if (this.options.method == 'get')
217
+ url += '?' + parameters;
218
+
219
+ this.transport.open(this.options.method, url,
220
+ this.options.asynchronous);
221
+
222
+ if (this.options.asynchronous) {
223
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
224
+ setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
225
+ }
226
+
227
+ this.setRequestHeaders();
228
+
229
+ var body = this.options.postBody ? this.options.postBody : parameters;
230
+ this.transport.send(this.options.method == 'post' ? body : null);
231
+
232
+ } catch (e) {
233
+ }
234
+ },
235
+
236
+ setRequestHeaders: function() {
237
+ var requestHeaders =
238
+ ['X-Requested-With', 'XMLHttpRequest',
239
+ 'X-Prototype-Version', Prototype.Version];
240
+
241
+ if (this.options.method == 'post') {
242
+ requestHeaders.push('Content-type',
243
+ 'application/x-www-form-urlencoded');
244
+
245
+ /* Force "Connection: close" for Mozilla browsers to work around
246
+ * a bug where XMLHttpReqeuest sends an incorrect Content-length
247
+ * header. See Mozilla Bugzilla #246651.
248
+ */
249
+ if (this.transport.overrideMimeType)
250
+ requestHeaders.push('Connection', 'close');
251
+ }
252
+
253
+ if (this.options.requestHeaders)
254
+ requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
255
+
256
+ for (var i = 0; i < requestHeaders.length; i += 2)
257
+ this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
258
+ },
259
+
260
+ onStateChange: function() {
261
+ var readyState = this.transport.readyState;
262
+ if (readyState != 1)
263
+ this.respondToReadyState(this.transport.readyState);
264
+ },
265
+
266
+ respondToReadyState: function(readyState) {
267
+ var event = Ajax.Request.Events[readyState];
268
+
269
+ if (event == 'Complete')
270
+ (this.options['on' + this.transport.status]
271
+ || this.options['on' + this.responseIsSuccess() ? 'Success' : 'Failure']
272
+ || Prototype.emptyFunction)(this.transport);
273
+
274
+ (this.options['on' + event] || Prototype.emptyFunction)(this.transport);
275
+
276
+ /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
277
+ if (event == 'Complete')
278
+ this.transport.onreadystatechange = Prototype.emptyFunction;
279
+ }
280
+ });
281
+
282
+ Ajax.Updater = Class.create();
283
+ Ajax.Updater.ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:<\/script>)';
284
+
285
+ Ajax.Updater.prototype.extend(Ajax.Request.prototype).extend({
286
+ initialize: function(container, url, options) {
287
+ this.containers = {
288
+ success: container.success ? $(container.success) : $(container),
289
+ failure: container.failure ? $(container.failure) :
290
+ (container.success ? null : $(container))
291
+ }
292
+
293
+ this.transport = Ajax.getTransport();
294
+ this.setOptions(options);
295
+
296
+ var onComplete = this.options.onComplete || Prototype.emptyFunction;
297
+ this.options.onComplete = (function() {
298
+ this.updateContent();
299
+ onComplete(this.transport);
300
+ }).bind(this);
301
+
302
+ this.request(url);
303
+ },
304
+
305
+ updateContent: function() {
306
+ var receiver = this.responseIsSuccess() ?
307
+ this.containers.success : this.containers.failure;
308
+
309
+ var match = new RegExp(Ajax.Updater.ScriptFragment, 'img');
310
+ var response = this.transport.responseText.replace(match, '');
311
+ var scripts = this.transport.responseText.match(match);
312
+
313
+ if (receiver) {
314
+ if (this.options.insertion) {
315
+ new this.options.insertion(receiver, response);
316
+ } else {
317
+ receiver.innerHTML = response;
318
+ }
319
+ }
320
+
321
+ if (this.responseIsSuccess()) {
322
+ if (this.onComplete)
323
+ setTimeout((function() {this.onComplete(
324
+ this.transport)}).bind(this), 10);
325
+ }
326
+
327
+ if (this.options.evalScripts && scripts) {
328
+ match = new RegExp(Ajax.Updater.ScriptFragment, 'im');
329
+ setTimeout((function() {
330
+ for (var i = 0; i < scripts.length; i++)
331
+ eval(scripts[i].match(match)[1]);
332
+ }).bind(this), 10);
333
+ }
334
+ }
335
+ });
336
+
337
+ Ajax.PeriodicalUpdater = Class.create();
338
+ Ajax.PeriodicalUpdater.prototype = (new Ajax.Base()).extend({
339
+ initialize: function(container, url, options) {
340
+ this.setOptions(options);
341
+ this.onComplete = this.options.onComplete;
342
+
343
+ this.frequency = (this.options.frequency || 2);
344
+ this.decay = 1;
345
+
346
+ this.updater = {};
347
+ this.container = container;
348
+ this.url = url;
349
+
350
+ this.start();
351
+ },
352
+
353
+ start: function() {
354
+ this.options.onComplete = this.updateComplete.bind(this);
355
+ this.onTimerEvent();
356
+ },
357
+
358
+ stop: function() {
359
+ this.updater.onComplete = undefined;
360
+ clearTimeout(this.timer);
361
+ (this.onComplete || Ajax.emptyFunction).apply(this, arguments);
362
+ },
363
+
364
+ updateComplete: function(request) {
365
+ if (this.options.decay) {
366
+ this.decay = (request.responseText == this.lastText ?
367
+ this.decay * this.options.decay : 1);
368
+
369
+ this.lastText = request.responseText;
370
+ }
371
+ this.timer = setTimeout(this.onTimerEvent.bind(this),
372
+ this.decay * this.frequency * 1000);
373
+ },
374
+
375
+ onTimerEvent: function() {
376
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
377
+ }
378
+ });
379
+
380
+ document.getElementsByClassName = function(className) {
381
+ var children = document.getElementsByTagName('*') || document.all;
382
+ var elements = new Array();
383
+
384
+ for (var i = 0; i < children.length; i++) {
385
+ var child = children[i];
386
+ var classNames = child.className.split(' ');
387
+ for (var j = 0; j < classNames.length; j++) {
388
+ if (classNames[j] == className) {
389
+ elements.push(child);
390
+ break;
391
+ }
392
+ }
393
+ }
394
+
395
+ return elements;
396
+ }
397
+
398
+ /*--------------------------------------------------------------------------*/
399
+
400
+ if (!window.Element) {
401
+ var Element = new Object();
402
+ }
403
+
404
+ Object.extend(Element, {
405
+ toggle: function() {
406
+ for (var i = 0; i < arguments.length; i++) {
407
+ var element = $(arguments[i]);
408
+ element.style.display =
409
+ (element.style.display == 'none' ? '' : 'none');
410
+ }
411
+ },
412
+
413
+ hide: function() {
414
+ for (var i = 0; i < arguments.length; i++) {
415
+ var element = $(arguments[i]);
416
+ element.style.display = 'none';
417
+ }
418
+ },
419
+
420
+ show: function() {
421
+ for (var i = 0; i < arguments.length; i++) {
422
+ var element = $(arguments[i]);
423
+ element.style.display = '';
424
+ }
425
+ },
426
+
427
+ remove: function(element) {
428
+ element = $(element);
429
+ element.parentNode.removeChild(element);
430
+ },
431
+
432
+ getHeight: function(element) {
433
+ element = $(element);
434
+ return element.offsetHeight;
435
+ },
436
+
437
+ hasClassName: function(element, className) {
438
+ element = $(element);
439
+ if (!element)
440
+ return;
441
+ var a = element.className.split(' ');
442
+ for (var i = 0; i < a.length; i++) {
443
+ if (a[i] == className)
444
+ return true;
445
+ }
446
+ return false;
447
+ },
448
+
449
+ addClassName: function(element, className) {
450
+ element = $(element);
451
+ Element.removeClassName(element, className);
452
+ element.className += ' ' + className;
453
+ },
454
+
455
+ removeClassName: function(element, className) {
456
+ element = $(element);
457
+ if (!element)
458
+ return;
459
+ var newClassName = '';
460
+ var a = element.className.split(' ');
461
+ for (var i = 0; i < a.length; i++) {
462
+ if (a[i] != className) {
463
+ if (i > 0)
464
+ newClassName += ' ';
465
+ newClassName += a[i];
466
+ }
467
+ }
468
+ element.className = newClassName;
469
+ },
470
+
471
+ // removes whitespace-only text node children
472
+ cleanWhitespace: function(element) {
473
+ var element = $(element);
474
+ for (var i = 0; i < element.childNodes.length; i++) {
475
+ var node = element.childNodes[i];
476
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
477
+ Element.remove(node);
478
+ }
479
+ }
480
+ });
481
+
482
+ var Toggle = new Object();
483
+ Toggle.display = Element.toggle;
484
+
485
+ /*--------------------------------------------------------------------------*/
486
+
487
+ Abstract.Insertion = function(adjacency) {
488
+ this.adjacency = adjacency;
489
+ }
490
+
491
+ Abstract.Insertion.prototype = {
492
+ initialize: function(element, content) {
493
+ this.element = $(element);
494
+ this.content = content;
495
+
496
+ if (this.adjacency && this.element.insertAdjacentHTML) {
497
+ this.element.insertAdjacentHTML(this.adjacency, this.content);
498
+ } else {
499
+ this.range = this.element.ownerDocument.createRange();
500
+ if (this.initializeRange) this.initializeRange();
501
+ this.fragment = this.range.createContextualFragment(this.content);
502
+ this.insertContent();
503
+ }
504
+ }
505
+ }
506
+
507
+ var Insertion = new Object();
508
+
509
+ Insertion.Before = Class.create();
510
+ Insertion.Before.prototype = (new Abstract.Insertion('beforeBegin')).extend({
511
+ initializeRange: function() {
512
+ this.range.setStartBefore(this.element);
513
+ },
514
+
515
+ insertContent: function() {
516
+ this.element.parentNode.insertBefore(this.fragment, this.element);
517
+ }
518
+ });
519
+
520
+ Insertion.Top = Class.create();
521
+ Insertion.Top.prototype = (new Abstract.Insertion('afterBegin')).extend({
522
+ initializeRange: function() {
523
+ this.range.selectNodeContents(this.element);
524
+ this.range.collapse(true);
525
+ },
526
+
527
+ insertContent: function() {
528
+ this.element.insertBefore(this.fragment, this.element.firstChild);
529
+ }
530
+ });
531
+
532
+ Insertion.Bottom = Class.create();
533
+ Insertion.Bottom.prototype = (new Abstract.Insertion('beforeEnd')).extend({
534
+ initializeRange: function() {
535
+ this.range.selectNodeContents(this.element);
536
+ this.range.collapse(this.element);
537
+ },
538
+
539
+ insertContent: function() {
540
+ this.element.appendChild(this.fragment);
541
+ }
542
+ });
543
+
544
+ Insertion.After = Class.create();
545
+ Insertion.After.prototype = (new Abstract.Insertion('afterEnd')).extend({
546
+ initializeRange: function() {
547
+ this.range.setStartAfter(this.element);
548
+ },
549
+
550
+ insertContent: function() {
551
+ this.element.parentNode.insertBefore(this.fragment,
552
+ this.element.nextSibling);
553
+ }
554
+ });
555
+
556
+ var Field = {
557
+ clear: function() {
558
+ for (var i = 0; i < arguments.length; i++)
559
+ $(arguments[i]).value = '';
560
+ },
561
+
562
+ focus: function(element) {
563
+ $(element).focus();
564
+ },
565
+
566
+ present: function() {
567
+ for (var i = 0; i < arguments.length; i++)
568
+ if ($(arguments[i]).value == '') return false;
569
+ return true;
570
+ },
571
+
572
+ select: function(element) {
573
+ $(element).select();
574
+ },
575
+
576
+ activate: function(element) {
577
+ $(element).focus();
578
+ $(element).select();
579
+ }
580
+ }
581
+
582
+ /*--------------------------------------------------------------------------*/
583
+
584
+ var Form = {
585
+ serialize: function(form) {
586
+ var elements = Form.getElements($(form));
587
+ var queryComponents = new Array();
588
+
589
+ for (var i = 0; i < elements.length; i++) {
590
+ var queryComponent = Form.Element.serialize(elements[i]);
591
+ if (queryComponent)
592
+ queryComponents.push(queryComponent);
593
+ }
594
+
595
+ return queryComponents.join('&');
596
+ },
597
+
598
+ getElements: function(form) {
599
+ var form = $(form);
600
+ var elements = new Array();
601
+
602
+ for (tagName in Form.Element.Serializers) {
603
+ var tagElements = form.getElementsByTagName(tagName);
604
+ for (var j = 0; j < tagElements.length; j++)
605
+ elements.push(tagElements[j]);
606
+ }
607
+ return elements;
608
+ },
609
+
610
+ getInputs: function(form, typeName, name) {
611
+ var form = $(form);
612
+ var inputs = form.getElementsByTagName('input');
613
+
614
+ if (!typeName && !name)
615
+ return inputs;
616
+
617
+ var matchingInputs = new Array();
618
+ for (var i = 0; i < inputs.length; i++) {
619
+ var input = inputs[i];
620
+ if ((typeName && input.type != typeName) ||
621
+ (name && input.name != name))
622
+ continue;
623
+ matchingInputs.push(input);
624
+ }
625
+
626
+ return matchingInputs;
627
+ },
628
+
629
+ disable: function(form) {
630
+ var elements = Form.getElements(form);
631
+ for (var i = 0; i < elements.length; i++) {
632
+ var element = elements[i];
633
+ element.blur();
634
+ element.disabled = 'true';
635
+ }
636
+ },
637
+
638
+ enable: function(form) {
639
+ var elements = Form.getElements(form);
640
+ for (var i = 0; i < elements.length; i++) {
641
+ var element = elements[i];
642
+ element.disabled = '';
643
+ }
644
+ },
645
+
646
+ focusFirstElement: function(form) {
647
+ var form = $(form);
648
+ var elements = Form.getElements(form);
649
+ for (var i = 0; i < elements.length; i++) {
650
+ var element = elements[i];
651
+ if (element.type != 'hidden' && !element.disabled) {
652
+ Field.activate(element);
653
+ break;
654
+ }
655
+ }
656
+ },
657
+
658
+ reset: function(form) {
659
+ $(form).reset();
660
+ }
661
+ }
662
+
663
+ Form.Element = {
664
+ serialize: function(element) {
665
+ var element = $(element);
666
+ var method = element.tagName.toLowerCase();
667
+ var parameter = Form.Element.Serializers[method](element);
668
+
669
+ if (parameter)
670
+ return encodeURIComponent(parameter[0]) + '=' +
671
+ encodeURIComponent(parameter[1]);
672
+ },
673
+
674
+ getValue: function(element) {
675
+ var element = $(element);
676
+ var method = element.tagName.toLowerCase();
677
+ var parameter = Form.Element.Serializers[method](element);
678
+
679
+ if (parameter)
680
+ return parameter[1];
681
+ }
682
+ }
683
+
684
+ Form.Element.Serializers = {
685
+ input: function(element) {
686
+ switch (element.type.toLowerCase()) {
687
+ case 'submit':
688
+ case 'hidden':
689
+ case 'password':
690
+ case 'text':
691
+ return Form.Element.Serializers.textarea(element);
692
+ case 'checkbox':
693
+ case 'radio':
694
+ return Form.Element.Serializers.inputSelector(element);
695
+ }
696
+ return false;
697
+ },
698
+
699
+ inputSelector: function(element) {
700
+ if (element.checked)
701
+ return [element.name, element.value];
702
+ },
703
+
704
+ textarea: function(element) {
705
+ return [element.name, element.value];
706
+ },
707
+
708
+ select: function(element) {
709
+ var value = '';
710
+ if (element.type == 'select-one') {
711
+ var index = element.selectedIndex;
712
+ if (index >= 0)
713
+ value = element.options[index].value || element.options[index].text;
714
+ } else {
715
+ value = new Array();
716
+ for (var i = 0; i < element.length; i++) {
717
+ var opt = element.options[i];
718
+ if (opt.selected)
719
+ value.push(opt.value || opt.text);
720
+ }
721
+ }
722
+ return [element.name, value];
723
+ }
724
+ }
725
+
726
+ /*--------------------------------------------------------------------------*/
727
+
728
+ var $F = Form.Element.getValue;
729
+
730
+ /*--------------------------------------------------------------------------*/
731
+
732
+ Abstract.TimedObserver = function() {}
733
+ Abstract.TimedObserver.prototype = {
734
+ initialize: function(element, frequency, callback) {
735
+ this.frequency = frequency;
736
+ this.element = $(element);
737
+ this.callback = callback;
738
+
739
+ this.lastValue = this.getValue();
740
+ this.registerCallback();
741
+ },
742
+
743
+ registerCallback: function() {
744
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
745
+ },
746
+
747
+ onTimerEvent: function() {
748
+ var value = this.getValue();
749
+ if (this.lastValue != value) {
750
+ this.callback(this.element, value);
751
+ this.lastValue = value;
752
+ }
753
+ }
754
+ }
755
+
756
+ Form.Element.Observer = Class.create();
757
+ Form.Element.Observer.prototype = (new Abstract.TimedObserver()).extend({
758
+ getValue: function() {
759
+ return Form.Element.getValue(this.element);
760
+ }
761
+ });
762
+
763
+ Form.Observer = Class.create();
764
+ Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
765
+ getValue: function() {
766
+ return Form.serialize(this.element);
767
+ }
768
+ });
769
+
770
+ /*--------------------------------------------------------------------------*/
771
+
772
+ Abstract.EventObserver = function() {}
773
+ Abstract.EventObserver.prototype = {
774
+ initialize: function(element, callback) {
775
+ this.element = $(element);
776
+ this.callback = callback;
777
+
778
+ this.lastValue = this.getValue();
779
+ if (this.element.tagName.toLowerCase() == 'form')
780
+ this.registerFormCallbacks();
781
+ else
782
+ this.registerCallback(this.element);
783
+ },
784
+
785
+ onElementEvent: function() {
786
+ var value = this.getValue();
787
+ if (this.lastValue != value) {
788
+ this.callback(this.element, value);
789
+ this.lastValue = value;
790
+ }
791
+ },
792
+
793
+ registerFormCallbacks: function() {
794
+ var elements = Form.getElements(this.element);
795
+ for (var i = 0; i < elements.length; i++)
796
+ this.registerCallback(elements[i]);
797
+ },
798
+
799
+ registerCallback: function(element) {
800
+ if (element.type) {
801
+ switch (element.type.toLowerCase()) {
802
+ case 'checkbox':
803
+ case 'radio':
804
+ element.target = this;
805
+ element.prev_onclick = element.onclick || Prototype.emptyFunction;
806
+ element.onclick = function() {
807
+ this.prev_onclick();
808
+ this.target.onElementEvent();
809
+ }
810
+ break;
811
+ case 'password':
812
+ case 'text':
813
+ case 'textarea':
814
+ case 'select-one':
815
+ case 'select-multiple':
816
+ element.target = this;
817
+ element.prev_onchange = element.onchange || Prototype.emptyFunction;
818
+ element.onchange = function() {
819
+ this.prev_onchange();
820
+ this.target.onElementEvent();
821
+ }
822
+ break;
823
+ }
824
+ }
825
+ }
826
+ }
827
+
828
+ Form.Element.EventObserver = Class.create();
829
+ Form.Element.EventObserver.prototype = (new Abstract.EventObserver()).extend({
830
+ getValue: function() {
831
+ return Form.Element.getValue(this.element);
832
+ }
833
+ });
834
+
835
+ Form.EventObserver = Class.create();
836
+ Form.EventObserver.prototype = (new Abstract.EventObserver()).extend({
837
+ getValue: function() {
838
+ return Form.serialize(this.element);
839
+ }
840
+ });
841
+
842
+
843
+ if (!window.Event) {
844
+ var Event = new Object();
845
+ }
846
+
847
+ Object.extend(Event, {
848
+ KEY_BACKSPACE: 8,
849
+ KEY_TAB: 9,
850
+ KEY_RETURN: 13,
851
+ KEY_ESC: 27,
852
+ KEY_LEFT: 37,
853
+ KEY_UP: 38,
854
+ KEY_RIGHT: 39,
855
+ KEY_DOWN: 40,
856
+ KEY_DELETE: 46,
857
+
858
+ element: function(event) {
859
+ return event.target || event.srcElement;
860
+ },
861
+
862
+ isLeftClick: function(event) {
863
+ return (((event.which) && (event.which == 1)) ||
864
+ ((event.button) && (event.button == 1)));
865
+ },
866
+
867
+ pointerX: function(event) {
868
+ return event.pageX || (event.clientX +
869
+ (document.documentElement.scrollLeft || document.body.scrollLeft));
870
+ },
871
+
872
+ pointerY: function(event) {
873
+ return event.pageY || (event.clientY +
874
+ (document.documentElement.scrollTop || document.body.scrollTop));
875
+ },
876
+
877
+ stop: function(event) {
878
+ if (event.preventDefault) {
879
+ event.preventDefault();
880
+ event.stopPropagation();
881
+ } else {
882
+ event.returnValue = false;
883
+ }
884
+ },
885
+
886
+ // find the first node with the given tagName, starting from the
887
+ // node the event was triggered on; traverses the DOM upwards
888
+ findElement: function(event, tagName) {
889
+ var element = Event.element(event);
890
+ while (element.parentNode && (!element.tagName ||
891
+ (element.tagName.toUpperCase() != tagName.toUpperCase())))
892
+ element = element.parentNode;
893
+ return element;
894
+ },
895
+
896
+ observers: false,
897
+
898
+ _observeAndCache: function(element, name, observer, useCapture) {
899
+ if (!this.observers) this.observers = [];
900
+ if (element.addEventListener) {
901
+ this.observers.push([element, name, observer, useCapture]);
902
+ element.addEventListener(name, observer, useCapture);
903
+ } else if (element.attachEvent) {
904
+ this.observers.push([element, name, observer, useCapture]);
905
+ element.attachEvent('on' + name, observer);
906
+ }
907
+ },
908
+
909
+ unloadCache: function() {
910
+ if (!Event.observers) return;
911
+ for (var i = 0; i < Event.observers.length; i++) {
912
+ Event.stopObserving.apply(this, Event.observers[i]);
913
+ Event.observers[i][0] = null;
914
+ }
915
+ Event.observers = false;
916
+ },
917
+
918
+ observe: function(element, name, observer, useCapture) {
919
+ var element = $(element);
920
+ useCapture = useCapture || false;
921
+
922
+ if (name == 'keypress' &&
923
+ ((navigator.appVersion.indexOf('AppleWebKit') > 0)
924
+ || element.attachEvent))
925
+ name = 'keydown';
926
+
927
+ this._observeAndCache(element, name, observer, useCapture);
928
+ },
929
+
930
+ stopObserving: function(element, name, observer, useCapture) {
931
+ var element = $(element);
932
+ useCapture = useCapture || false;
933
+
934
+ if (name == 'keypress' &&
935
+ ((navigator.appVersion.indexOf('AppleWebKit') > 0)
936
+ || element.detachEvent))
937
+ name = 'keydown';
938
+
939
+ if (element.removeEventListener) {
940
+ element.removeEventListener(name, observer, useCapture);
941
+ } else if (element.detachEvent) {
942
+ element.detachEvent('on' + name, observer);
943
+ }
944
+ }
945
+ });
946
+
947
+ /* prevent memory leaks in IE */
948
+ Event.observe(window, 'unload', Event.unloadCache, false);
949
+
950
+ var Position = {
951
+
952
+ // set to true if needed, warning: firefox performance problems
953
+ // NOT neeeded for page scrolling, only if draggable contained in
954
+ // scrollable elements
955
+ includeScrollOffsets: false,
956
+
957
+ // must be called before calling withinIncludingScrolloffset, every time the
958
+ // page is scrolled
959
+ prepare: function() {
960
+ this.deltaX = window.pageXOffset
961
+ || document.documentElement.scrollLeft
962
+ || document.body.scrollLeft
963
+ || 0;
964
+ this.deltaY = window.pageYOffset
965
+ || document.documentElement.scrollTop
966
+ || document.body.scrollTop
967
+ || 0;
968
+ },
969
+
970
+ realOffset: function(element) {
971
+ var valueT = 0, valueL = 0;
972
+ do {
973
+ valueT += element.scrollTop || 0;
974
+ valueL += element.scrollLeft || 0;
975
+ element = element.parentNode;
976
+ } while (element);
977
+ return [valueL, valueT];
978
+ },
979
+
980
+ cumulativeOffset: function(element) {
981
+ var valueT = 0, valueL = 0;
982
+ do {
983
+ valueT += element.offsetTop || 0;
984
+ valueL += element.offsetLeft || 0;
985
+ element = element.offsetParent;
986
+ } while (element);
987
+ return [valueL, valueT];
988
+ },
989
+
990
+ // caches x/y coordinate pair to use with overlap
991
+ within: function(element, x, y) {
992
+ if (this.includeScrollOffsets)
993
+ return this.withinIncludingScrolloffsets(element, x, y);
994
+ this.xcomp = x;
995
+ this.ycomp = y;
996
+ this.offset = this.cumulativeOffset(element);
997
+
998
+ return (y >= this.offset[1] &&
999
+ y < this.offset[1] + element.offsetHeight &&
1000
+ x >= this.offset[0] &&
1001
+ x < this.offset[0] + element.offsetWidth);
1002
+ },
1003
+
1004
+ withinIncludingScrolloffsets: function(element, x, y) {
1005
+ var offsetcache = this.realOffset(element);
1006
+
1007
+ this.xcomp = x + offsetcache[0] - this.deltaX;
1008
+ this.ycomp = y + offsetcache[1] - this.deltaY;
1009
+ this.offset = this.cumulativeOffset(element);
1010
+
1011
+ return (this.ycomp >= this.offset[1] &&
1012
+ this.ycomp < this.offset[1] + element.offsetHeight &&
1013
+ this.xcomp >= this.offset[0] &&
1014
+ this.xcomp < this.offset[0] + element.offsetWidth);
1015
+ },
1016
+
1017
+ // within must be called directly before
1018
+ overlap: function(mode, element) {
1019
+ if (!mode) return 0;
1020
+ if (mode == 'vertical')
1021
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
1022
+ element.offsetHeight;
1023
+ if (mode == 'horizontal')
1024
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
1025
+ element.offsetWidth;
1026
+ },
1027
+
1028
+ clone: function(source, target) {
1029
+ source = $(source);
1030
+ target = $(target);
1031
+ target.style.position = 'absolute';
1032
+ var offsets = this.cumulativeOffset(source);
1033
+ target.style.top = offsets[1] + 'px';
1034
+ target.style.left = offsets[0] + 'px';
1035
+ target.style.width = source.offsetWidth + 'px';
1036
+ target.style.height = source.offsetHeight + 'px';
1037
+ }
1038
+ }