Zend_Validate-Messages.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 18942 -->
  4. <sect1 id="zend.validate.messages">
  5. <title>検証メッセージ</title>
  6. <para>
  7. <classname>Zend_Validate</classname> を継承したバリデータには、
  8. 検証に失敗したときに使用するメッセージが用意されています。
  9. ここにまとめた情報をもとに、
  10. 独自のメッセージを設定したりバリデータが返すメッセージを翻訳したりできます。
  11. 次の表は、各バリデータが返すすべてのメッセージをまとめたものです。
  12. </para>
  13. <table id="zend.validate.messages.table">
  14. <title>利用可能な検証メッセージ</title>
  15. <tgroup cols="3">
  16. <thead>
  17. <row>
  18. <entry>バリデータ</entry>
  19. <entry>定数</entry>
  20. <entry>メッセージ</entry>
  21. </row>
  22. </thead>
  23. <tbody>
  24. <row>
  25. <entry morerows="1" valign="middle">Alnum</entry>
  26. <entry><constant>NOT_ALNUM</constant></entry>
  27. <entry>'%value%' has not only alphabetic and digit characters</entry>
  28. </row>
  29. <row>
  30. <entry><constant>STRING_EMPTY</constant></entry>
  31. <entry>'%value%' is an empty string</entry>
  32. </row>
  33. <row>
  34. <entry morerows="1" valign="middle">Alpha</entry>
  35. <entry><constant>NOT_ALPHA</constant></entry>
  36. <entry>'%value%' has not only alphabetic characters</entry>
  37. </row>
  38. <row>
  39. <entry><constant>STRING_EMPTY</constant></entry>
  40. <entry>'%value%' is an empty string</entry>
  41. </row>
  42. <row>
  43. <entry>Barcode</entry>
  44. <entry>---</entry>
  45. <entry>messages are thrown by a subclass</entry>
  46. </row>
  47. <row>
  48. <entry morerows="2" valign="middle">Barcode_Ean13</entry>
  49. <entry><constant>INVALID</constant></entry>
  50. <entry>'%value%' is an invalid <constant>EAN</constant>-13 barcode</entry>
  51. </row>
  52. <row>
  53. <entry><constant>INVALID_LENGTH</constant></entry>
  54. <entry>'%value%' should be 13 characters</entry>
  55. </row>
  56. <row>
  57. <entry><constant>NOT_NUMERIC</constant></entry>
  58. <entry>'%value%' should contain only numeric characters</entry>
  59. </row>
  60. <row>
  61. <entry morerows="1" valign="middle">Barcode_UpcA</entry>
  62. <entry><constant>INVALID</constant></entry>
  63. <entry>'%value%' is an invalid <constant>UPC</constant>-A barcode</entry>
  64. </row>
  65. <row>
  66. <entry><constant>INVALID_LENGTH</constant></entry>
  67. <entry>'%value%' should be 12 characters</entry>
  68. </row>
  69. <row>
  70. <entry morerows="1" valign="middle">Between</entry>
  71. <entry><constant>NOT_BETWEEN</constant></entry>
  72. <entry>'%value%' is not between '%min%' and '%max%', inclusively</entry>
  73. </row>
  74. <row>
  75. <entry><constant>NOT_BETWEEN_STRICT</constant></entry>
  76. <entry>'%value%' is not strictly between '%min%' and '%max%'</entry>
  77. </row>
  78. <row>
  79. <entry morerows="1" valign="middle">Ccnum</entry>
  80. <entry><constant>LENGTH</constant></entry>
  81. <entry>'%value%' must contain between 13 and 19 digits</entry>
  82. </row>
  83. <row>
  84. <entry><constant>CHECKSUM</constant></entry>
  85. <entry>Luhn algorithm (mod-10 checksum) failed on '%value%'</entry>
  86. </row>
  87. <row>
  88. <entry morerows="1" valign="middle">Date</entry>
  89. <entry><constant>FALSEFORMAT</constant></entry>
  90. <entry>'%value%' does not fit given date format</entry>
  91. </row>
  92. <row>
  93. <entry><constant>INVALID</constant></entry>
  94. <entry>'%value%' does not appear to be a valid date</entry>
  95. </row>
  96. <row>
  97. <entry morerows="1" valign="middle">Db_Abstract</entry>
  98. <entry><constant>ERROR_NO_RECORD_FOUND</constant></entry>
  99. <entry>No record matching %value% was found</entry>
  100. </row>
  101. <row>
  102. <entry><constant>ERROR_RECORD_FOUND</constant></entry>
  103. <entry>A record matching %value% was found</entry>
  104. </row>
  105. <row>
  106. <entry morerows="1" valign="middle">Digits</entry>
  107. <entry><constant>NOT_DIGITS</constant></entry>
  108. <entry>'%value%' contains not only digit characters</entry>
  109. </row>
  110. <row>
  111. <entry><constant>STRING_EMPTY</constant></entry>
  112. <entry>'%value%' is an empty string</entry>
  113. </row>
  114. <row>
  115. <entry morerows="7" valign="middle">EmailAddress</entry>
  116. <entry><constant>INVALID</constant></entry>
  117. <entry>
  118. '%value%' is not a valid email address in the basic format
  119. local-part@hostname
  120. </entry>
  121. </row>
  122. <row>
  123. <entry><constant>INVALID_FORMAT</constant></entry>
  124. <entry>'%value%' is not a valid email address in the basic format local-part@hostname</entry>
  125. </row>
  126. <row>
  127. <entry><constant>INVALID_HOSTNAME</constant></entry>
  128. <entry>'%hostname%' is not a valid hostname for email address '%value%'</entry>
  129. </row>
  130. <row>
  131. <entry><constant>INVALID_MX_RECORD</constant></entry>
  132. <entry>
  133. '%hostname%' does not appear to have a valid MX record for the email address
  134. '%value%'
  135. </entry>
  136. </row>
  137. <row>
  138. <entry><constant>DOT_ATOM</constant></entry>
  139. <entry>'%localPart%' not matched against dot-atom format</entry>
  140. </row>
  141. <row>
  142. <entry><constant>QUOTED_STRING</constant></entry>
  143. <entry>'%localPart%' not matched against quoted-string format</entry>
  144. </row>
  145. <row>
  146. <entry><constant>INVALID_LOCAL_PART</constant></entry>
  147. <entry>
  148. '%localPart%' is not a valid local part for email address '%value%'
  149. </entry>
  150. </row>
  151. <row>
  152. <entry><constant>LENGTH_EXCEEDED</constant></entry>
  153. <entry>'%value%' exceeds the allowed length</entry>
  154. </row>
  155. <row>
  156. <entry morerows="1" valign="middle">File_Count</entry>
  157. <entry><constant>TOO_MUCH</constant></entry>
  158. <entry>
  159. Too much files, maximum '%max%' are allowed but '%count%' are given
  160. </entry>
  161. </row>
  162. <row>
  163. <entry><constant>TOO_LESS</constant></entry>
  164. <entry>
  165. Too less files, minimum '%min%' are expected but '%count%' are given
  166. </entry>
  167. </row>
  168. <row>
  169. <entry morerows="2" valign="middle">File_Crc32</entry>
  170. <entry><constant>DOES_NOT_MATCH</constant></entry>
  171. <entry>The file '%value%' does not match the given crc32 hashes</entry>
  172. </row>
  173. <row>
  174. <entry><constant>NOT_DETECTED</constant></entry>
  175. <entry>There was no crc32 hash detected for the given file</entry>
  176. </row>
  177. <row>
  178. <entry><constant>NOT_FOUND</constant></entry>
  179. <entry>The file '%value%' could not be found</entry>
  180. </row>
  181. <row>
  182. <entry morerows="1" valign="middle">File_ExcludeExtension</entry>
  183. <entry><constant>FALSE_EXTENSION</constant></entry>
  184. <entry>The file '%value%' has a false extension</entry>
  185. </row>
  186. <row>
  187. <entry><constant>NOT_FOUND</constant></entry>
  188. <entry>The file '%value%' was not found</entry>
  189. </row>
  190. <row>
  191. <entry morerows="2" valign="middle">File_ExcludeMimeType</entry>
  192. <entry><constant>FALSE_TYPE</constant></entry>
  193. <entry>The file '%value%' has a false mimetype of '%type%'</entry>
  194. </row>
  195. <row>
  196. <entry><constant>NOT_DETECTED</constant></entry>
  197. <entry>The mimetype of file '%value%' could not been detected</entry>
  198. </row>
  199. <row>
  200. <entry><constant>NOT_READABLE</constant></entry>
  201. <entry>The file '%value%' can not be read</entry>
  202. </row>
  203. <row>
  204. <entry>File_Exists</entry>
  205. <entry><constant>DOES_NOT_EXIST</constant></entry>
  206. <entry>The file '%value%' does not exist</entry>
  207. </row>
  208. <row>
  209. <entry morerows="1" valign="middle">File_Extension</entry>
  210. <entry><constant>FALSE_EXTENSION</constant></entry>
  211. <entry>The file '%value%' has a false extension</entry>
  212. </row>
  213. <row>
  214. <entry><constant>NOT_FOUND</constant></entry>
  215. <entry>The file '%value%' was not found</entry>
  216. </row>
  217. <row>
  218. <entry morerows="2" valign="middle">File_FilesSize</entry>
  219. <entry><constant>TOO_BIG</constant></entry>
  220. <entry>
  221. All files in sum should have a maximum size of '%max%' but '%size%' were
  222. detected
  223. </entry>
  224. </row>
  225. <row>
  226. <entry><constant>TOO_SMALL</constant></entry>
  227. <entry>
  228. All files in sum should have a minimum size of '%min%' but '%size%' were
  229. detected
  230. </entry>
  231. </row>
  232. <row>
  233. <entry><constant>NOT_READABLE</constant></entry>
  234. <entry>One or more files can not be read</entry>
  235. </row>
  236. <row>
  237. <entry morerows="2" valign="middle">File_Hash</entry>
  238. <entry><constant>DOES_NOT_MATCH</constant></entry>
  239. <entry>The file '%value%' does not match the given hashes</entry>
  240. </row>
  241. <row>
  242. <entry><constant>NOT_DETECTED</constant></entry>
  243. <entry>There was no hash detected for the given file</entry>
  244. </row>
  245. <row>
  246. <entry><constant>NOT_FOUND</constant></entry>
  247. <entry>The file '%value%' could not be found</entry>
  248. </row>
  249. <row>
  250. <entry morerows="5" valign="middle">File_ImageSize</entry>
  251. <entry><constant>WIDTH_TOO_BIG</constant></entry>
  252. <entry>
  253. Maximum allowed width for image '%value%' should be '%maxwidth%' but
  254. '%width%' detected
  255. </entry>
  256. </row>
  257. <row>
  258. <entry><constant>WIDTH_TOO_SMALL</constant></entry>
  259. <entry>
  260. Minimum expected width for image '%value%' should be '%minwidth%' but
  261. '%width%' detected
  262. </entry>
  263. </row>
  264. <row>
  265. <entry><constant>HEIGHT_TOO_BIG</constant></entry>
  266. <entry>
  267. Maximum allowed height for image '%value%' should be '%maxheight%' but
  268. '%height%' detected
  269. </entry>
  270. </row>
  271. <row>
  272. <entry><constant>HEIGHT_TOO_SMALL</constant></entry>
  273. <entry>
  274. Minimum expected height for image '%value%' should be '%minheight%' but
  275. '%height%' detected
  276. </entry>
  277. </row>
  278. <row>
  279. <entry><constant>NOT_DETECTED</constant></entry>
  280. <entry>The size of image '%value%' could not be detected</entry>
  281. </row>
  282. <row>
  283. <entry><constant>NOT_READABLE</constant></entry>
  284. <entry>The image '%value%' can not be read</entry>
  285. </row>
  286. <row>
  287. <entry morerows="2" valign="middle">File_IsCompressed</entry>
  288. <entry><constant>FALSE_TYPE</constant></entry>
  289. <entry>The file '%value%' is not compressed, '%type%' detected</entry>
  290. </row>
  291. <row>
  292. <entry><constant>NOT_DETECTED</constant></entry>
  293. <entry>The mimetype of file '%value%' could not been detected</entry>
  294. </row>
  295. <row>
  296. <entry><constant>NOT_READABLE</constant></entry>
  297. <entry>The file '%value%' can not be read</entry>
  298. </row>
  299. <row>
  300. <entry morerows="2" valign="middle">File_IsImage</entry>
  301. <entry><constant>FALSE_TYPE</constant></entry>
  302. <entry>The file '%value%' is no image, '%type%' detected</entry>
  303. </row>
  304. <row>
  305. <entry><constant>NOT_DETECTED</constant></entry>
  306. <entry>The mimetype of file '%value%' could not been detected</entry>
  307. </row>
  308. <row>
  309. <entry><constant>NOT_READABLE</constant></entry>
  310. <entry>The file '%value%' can not be read</entry>
  311. </row>
  312. <row>
  313. <entry morerows="2" valign="middle">File_Md5</entry>
  314. <entry><constant>DOES_NOT_MATCH</constant></entry>
  315. <entry>The file '%value%' does not match the given md5 hashes</entry>
  316. </row>
  317. <row>
  318. <entry><constant>NOT_DETECTED</constant></entry>
  319. <entry>There was no md5 hash detected for the given file</entry>
  320. </row>
  321. <row>
  322. <entry><constant>NOT_FOUND</constant></entry>
  323. <entry>The file '%value%' could not be found</entry>
  324. </row>
  325. <row>
  326. <entry morerows="2" valign="middle">File_MimeType</entry>
  327. <entry><constant>FALSE_TYPE</constant></entry>
  328. <entry>The file '%value%' has a false mimetype of '%type%'</entry>
  329. </row>
  330. <row>
  331. <entry><constant>NOT_DETECTED</constant></entry>
  332. <entry>The mimetype of file '%value%' could not been detected</entry>
  333. </row>
  334. <row>
  335. <entry><constant>NOT_READABLE</constant></entry>
  336. <entry>The file '%value%' can not be read</entry>
  337. </row>
  338. <row>
  339. <entry>File_NotExists</entry>
  340. <entry><constant>DOES_EXIST</constant></entry>
  341. <entry>The file '%value%' does exist</entry>
  342. </row>
  343. <row>
  344. <entry morerows="2" valign="middle">File_Sha1</entry>
  345. <entry><constant>DOES_NOT_MATCH</constant></entry>
  346. <entry>The file '%value%' does not match the given sha1 hashes</entry>
  347. </row>
  348. <row>
  349. <entry><constant>NOT_DETECTED</constant></entry>
  350. <entry>There was no sha1 hash detected for the given file</entry>
  351. </row>
  352. <row>
  353. <entry><constant>NOT_FOUND</constant></entry>
  354. <entry>The file '%value%' could not be found</entry>
  355. </row>
  356. <row>
  357. <entry morerows="2" valign="middle">File_Size</entry>
  358. <entry><constant>TOO_BIG</constant></entry>
  359. <entry>
  360. Maximum allowed size for file '%value%' is '%max%' but '%size%' detected
  361. </entry>
  362. </row>
  363. <row>
  364. <entry><constant>TOO_SMALL</constant></entry>
  365. <entry>
  366. Minimum expected size for file '%value%' is '%min%' but '%size%' detected
  367. </entry>
  368. </row>
  369. <row>
  370. <entry><constant>NOT_FOUND</constant></entry>
  371. <entry>The file '%value%' could not be found</entry>
  372. </row>
  373. <row>
  374. <entry morerows="9" valign="middle">File_Upload</entry>
  375. <entry><constant>INI_SIZE</constant></entry>
  376. <entry>The file '%value%' exceeds the defined ini size</entry>
  377. </row>
  378. <row>
  379. <entry><constant>FORM_SIZE</constant></entry>
  380. <entry>The file '%value%' exceeds the defined form size</entry>
  381. </row>
  382. <row>
  383. <entry><constant>PARTIAL</constant></entry>
  384. <entry>The file '%value%' was only partially uploaded</entry>
  385. </row>
  386. <row>
  387. <entry><constant>NO_FILE</constant></entry>
  388. <entry>The file '%value%' was not uploaded</entry>
  389. </row>
  390. <row>
  391. <entry><constant>NO_TMP_DIR</constant></entry>
  392. <entry>No temporary directory was found for the file '%value%'</entry>
  393. </row>
  394. <row>
  395. <entry><constant>CANT_WRITE</constant></entry>
  396. <entry>The file '%value%' can't be written</entry>
  397. </row>
  398. <row>
  399. <entry><constant>EXTENSION</constant></entry>
  400. <entry>
  401. The extension returned an error while uploading the file '%value%'
  402. </entry>
  403. </row>
  404. <row>
  405. <entry><constant>ATTACK</constant></entry>
  406. <entry>The file '%value%' was illegal uploaded, possible attack</entry>
  407. </row>
  408. <row>
  409. <entry><constant>FILE_NOT_FOUND</constant></entry>
  410. <entry>The file '%value%' was not found</entry>
  411. </row>
  412. <row>
  413. <entry><constant>UNKNOWN</constant></entry>
  414. <entry>Unknown error while uploading the file '%value%'</entry>
  415. </row>
  416. <row>
  417. <entry morerows="2" valign="middle">File_WordCount</entry>
  418. <entry><constant>TOO_MUCH</constant></entry>
  419. <entry>
  420. Too much words, maximum '%max%' are allowed but '%count%' were counted
  421. </entry>
  422. </row>
  423. <row>
  424. <entry><constant>TOO_LESS</constant></entry>
  425. <entry>
  426. Too less words, minimum '%min%' are expected but '%count%' were counted
  427. </entry>
  428. </row>
  429. <row>
  430. <entry><constant>NOT_FOUND</constant></entry>
  431. <entry>The file '%value%' could not be found</entry>
  432. </row>
  433. <row>
  434. <entry>Float</entry>
  435. <entry><constant>NOT_FLOAT</constant></entry>
  436. <entry>'%value%' does not appear to be a float</entry>
  437. </row>
  438. <row>
  439. <entry>GreaterThan</entry>
  440. <entry><constant>NOT_GREATER</constant></entry>
  441. <entry>'%value%' is not greater than '%min%'</entry>
  442. </row>
  443. <row>
  444. <entry>Hex</entry>
  445. <entry><constant>NOT_HEX</constant></entry>
  446. <entry>'%value%' has not only hexadecimal digit characters</entry>
  447. </row>
  448. <row>
  449. <entry morerows="7" valign="middle">Hostname</entry>
  450. <entry><constant>IP_ADDRESS_NOT_ALLOWED</constant></entry>
  451. <entry>
  452. '%value%' appears to be an IP address, but IP addresses are not allowed
  453. </entry>
  454. </row>
  455. <row>
  456. <entry><constant>UNKNOWN_TLD</constant></entry>
  457. <entry>
  458. '%value%' appears to be a <acronym>DNS</acronym> hostname but cannot match <acronym>TLD</acronym> against known
  459. list
  460. </entry>
  461. </row>
  462. <row>
  463. <entry><constant>INVALID_DASH</constant></entry>
  464. <entry>
  465. '%value%' appears to be a <acronym>DNS</acronym> hostname but contains a dash (-) in an invalid
  466. position
  467. </entry>
  468. </row>
  469. <row>
  470. <entry><constant>INVALID_HOSTNAME_SCHEMA</constant></entry>
  471. <entry>
  472. '%value%' appears to be a <acronym>DNS</acronym> hostname but cannot match against hostname
  473. schema for <acronym>TLD</acronym> '%tld%'
  474. </entry>
  475. </row>
  476. <row>
  477. <entry><constant>UNDECIPHERABLE_TLD</constant></entry>
  478. <entry>
  479. '%value%' appears to be a <acronym>DNS</acronym> hostname but cannot extract <acronym>TLD</acronym> part
  480. </entry>
  481. </row>
  482. <row>
  483. <entry><constant>INVALID_HOSTNAME</constant></entry>
  484. <entry>
  485. '%value%' does not match the expected structure for a <acronym>DNS</acronym> hostname
  486. </entry>
  487. </row>
  488. <row>
  489. <entry><constant>INVALID_LOCAL_NAME</constant></entry>
  490. <entry>'%value%' does not appear to be a valid local network name</entry>
  491. </row>
  492. <row>
  493. <entry><constant>LOCAL_NAME_NOT_ALLOWED</constant></entry>
  494. <entry>
  495. '%value%' appears to be a local network name but local network names are not
  496. allowed
  497. </entry>
  498. </row>
  499. <row>
  500. <entry morerows="2" valign="middle">Iban</entry>
  501. <entry><constant>NOTSUPPORTED</constant></entry>
  502. <entry>'%value%' does not have <acronym>IBAN</acronym></entry>
  503. </row>
  504. <row>
  505. <entry><constant>FALSEFORMAT</constant></entry>
  506. <entry>'%value%' has a false format</entry>
  507. </row>
  508. <row>
  509. <entry><constant>CHECKFAILED</constant></entry>
  510. <entry>'%value%' has failed the <acronym>IBAN</acronym> check</entry>
  511. </row>
  512. <row>
  513. <entry morerows="1" valign="middle">Identical</entry>
  514. <entry><constant>NOT_SAME</constant></entry>
  515. <entry>The token '%token%' does not match the given token '%value%'</entry>
  516. </row>
  517. <row>
  518. <entry><constant>MISSING_TOKEN</constant></entry>
  519. <entry>No token was provided to match against</entry>
  520. </row>
  521. <row>
  522. <entry>InArray</entry>
  523. <entry><constant>NOT_IN_ARRAY</constant></entry>
  524. <entry>'%value%' was not found in the haystack</entry>
  525. </row>
  526. <row>
  527. <entry>Int</entry>
  528. <entry><constant>NOT_INT</constant></entry>
  529. <entry>'%value%' does not appear to be an integer</entry>
  530. </row>
  531. <row>
  532. <entry>Ip</entry>
  533. <entry><constant>NOT_IP_ADDRESS</constant></entry>
  534. <entry>'%value%' does not appear to be a valid IP address</entry>
  535. </row>
  536. <row>
  537. <entry>LessThan</entry>
  538. <entry><constant>NOT_LESS</constant></entry>
  539. <entry>'%value%' is not less than '%max%'</entry>
  540. </row>
  541. <row>
  542. <entry>NotEmpty</entry>
  543. <entry><constant>IS_EMPTY</constant></entry>
  544. <entry>Value is required and can't be empty</entry>
  545. </row>
  546. <row>
  547. <entry>Regex</entry>
  548. <entry><constant>NOT_MATCH</constant></entry>
  549. <entry>'%value%' does not match against pattern '%pattern%'</entry>
  550. </row>
  551. <row>
  552. <entry morerows="1" valign="middle">StringLength</entry>
  553. <entry><constant>TOO_SHORT</constant></entry>
  554. <entry>'%value%' is less than %min% characters long</entry>
  555. </row>
  556. <row>
  557. <entry><constant>TOO_LONG</constant></entry>
  558. <entry>'%value%' is greater than %max% characters long</entry>
  559. </row>
  560. </tbody>
  561. </tgroup>
  562. </table>
  563. <para>
  564. さらに、<methodname>getMessageTemplates()</methodname>
  565. メソッドを使うとバリデータの全メッセージテンプレートを取得できます。
  566. これは、検証に失敗したときにバリデータが返す可能性のあるメッセージを配列で返します。
  567. </para>
  568. <programlisting language="php"><![CDATA[
  569. $validator = new Zend_Validate_Alnum();
  570. $messages = $validator->getMessageTemplates();
  571. ]]></programlisting>
  572. <sect2 id="zend.validate.messages.limitation">
  573. <title>検証メッセージのサイズの制限</title>
  574. <para>
  575. 検証メッセージの最大サイズを制限しなければならないこともあるでしょう。
  576. たとえば、1 行に 100 文字までしかレンダリングできないなどの制限がビューにある場合です。
  577. このような場合のため、<classname>Zend_Validate</classname>
  578. では自動的に検証メッセージの最大長を制限できるようになっています。
  579. </para>
  580. <para>
  581. 実際に設定されているサイズを取得するには
  582. <methodname>Zend_Validate::getMessageLength()</methodname> を使用します。
  583. この結果が -1 の場合は、返されるメッセージが切り詰められることはありません。
  584. これがデフォルトの挙動です。
  585. </para>
  586. <para>
  587. 返されるメッセージのサイズを制限するには
  588. <methodname>Zend_Validate::setMessageLength()</methodname> を使用します。
  589. 必要に応じて任意の整数値を設定します。
  590. 返されるメッセージのサイズがここで設定した長さを超えると、
  591. メッセージが切り詰められて最後に文字列 '<emphasis>...</emphasis>'
  592. が付加されます。
  593. </para>
  594. <programlisting language="php"><![CDATA[
  595. Zend_Validate::setMessageLength(100);
  596. ]]></programlisting>
  597. <note>
  598. <para>
  599. ここで設定したメッセージ長はすべてのバリデータに適用されることに注意しましょう。
  600. 自前で定義したバリデータに関しても、それが <classname>Zend_Validate_Abstract</classname>
  601. を継承したものである限りは同じです。
  602. </para>
  603. </note>
  604. </sect2>
  605. </sect1>
  606. <!--
  607. vim:se ts=4 sw=4 et:
  608. -->