2
0

documentation-standard.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 18134 -->
  4. <appendix id="doc-standard">
  5. <title>Zend Framework ドキュメント標準</title>
  6. <sect1 id="doc-standard.overview">
  7. <title>概要</title>
  8. <sect2 id="doc-standard.overview.scope">
  9. <title>スコープ</title>
  10. <para>
  11. <!-- TODO : to be translated -->
  12. This document provides guidelines for creation of the end-user
  13. documentation found within Zend Framework. It is intended as a
  14. guide to Zend Framework contributors, who must write
  15. documentation as part of component contributions, as well as to
  16. documentation translators. The standards contained herein are
  17. intended to ease translation of documentation, minimize
  18. visual and stylistic differences between different documentation
  19. files, and make finding changes in documentation easier with
  20. <command>diff</command> tools.
  21. </para>
  22. <para>
  23. You may adopt and/or modify these standards in accordance with the terms of our
  24. <ulink url="http://framework.zend.com/license">license</ulink>.
  25. </para>
  26. <para>
  27. Topics covered in Zend Framework's documentation standards include documentation
  28. file formatting and recommendations for documentation quality.
  29. </para>
  30. </sect2>
  31. </sect1>
  32. <sect1 id="doc-standard.file-formatting">
  33. <title>ドキュメントファイル形式</title>
  34. <sect2 id="doc-standard.file-formatting.xml-tags">
  35. <title>XML タグ</title>
  36. <para>
  37. Each manual file must include the following <acronym>XML</acronym> declarations at
  38. the top of the file:
  39. </para>
  40. <programlisting language="xml"><![CDATA[
  41. <?xml version="1.0" encoding="UTF-8"?>
  42. <!-- Reviewed: no -->
  43. ]]></programlisting>
  44. <para>
  45. <acronym>XML</acronym> files from translated languages must also include a revision
  46. tag containing the revision of the corresponding English-language file the
  47. translation was based on.
  48. </para>
  49. <programlisting language="xml"><![CDATA[
  50. <?xml version="1.0" encoding="UTF-8"?>
  51. <!-- EN-Revision: 14978 -->
  52. <!-- Reviewed: no -->
  53. ]]></programlisting>
  54. </sect2>
  55. <sect2 id="doc-standard.file-formatting.max-line-length">
  56. <title>行の最大長</title>
  57. <para>
  58. The maximum line length, including tags, attributes, and indentation, is not to
  59. exceed 100 characters. There is only one exception to this rule: attribute and value
  60. pairs are allowed to exceed the 100 chars as they are not allowed to be seperated.
  61. </para>
  62. </sect2>
  63. <sect2 id="doc-standard.file-formatting.indentation">
  64. <title>インデント</title>
  65. <para>Indentation should consist of 4 spaces. Tabs are not allowed.</para>
  66. <para>Tags which are at the same level must have the same indentation.</para>
  67. <programlisting language="xml"><![CDATA[
  68. <sect1>
  69. </sect1>
  70. <sect1>
  71. </sect1>
  72. ]]></programlisting>
  73. <para>
  74. Tags which are one level under the previous tag must be indented with 4 additional
  75. spaces.
  76. </para>
  77. <programlisting language="xml"><![CDATA[
  78. <sect1>
  79. <sect2>
  80. </sect2>
  81. </sect1>
  82. ]]></programlisting>
  83. <para>
  84. Multiple block tags within the same line are not allowed; multiple inline tags are
  85. allowed, however.
  86. </para>
  87. <programlisting language="xml"><![CDATA[
  88. <!-- NOT ALLOWED: -->
  89. <sect1><sect2>
  90. </sect2></sect1>
  91. <!-- ALLOWED -->
  92. <para>
  93. <classname>Zend_Magic</classname> does not exist. <classname>Zend_Acl</classname> does.
  94. </para>
  95. ]]></programlisting>
  96. </sect2>
  97. <sect2 id="doc-standard.file-formatting.line-termination">
  98. <title>行の終端</title>
  99. <para>
  100. Line termination follows the Unix text file convention. Lines must end with a
  101. single linefeed (LF) character. Linefeed characters are represented as ordinal 10,
  102. or hexadecimal 0x0A.
  103. </para>
  104. <para>
  105. Note: Do not use carriage returns (<acronym>CR</acronym>) as is the convention in
  106. Apple OS's (0x0D) or the carriage return - linefeed combination
  107. (<acronym>CRLF</acronym>) as is standard for the Windows OS (0x0D, 0x0A).
  108. </para>
  109. </sect2>
  110. <sect2 id="doc-standard.file-formatting.empty-tags">
  111. <title>空のタグ</title>
  112. <para>
  113. 空のタグは認められません。タグは全てテキストまたは子供タグを含まなければいけません。
  114. </para>
  115. <programlisting language="xml"><![CDATA[
  116. <!-- NOT ALLOWED -->
  117. <para>
  118. Some text. <link></link>
  119. </para>
  120. <para>
  121. </para>
  122. ]]></programlisting>
  123. </sect2>
  124. <sect2 id="doc-standard.file-formatting.whitespace">
  125. <title>ドキュメント内での空白の利用</title>
  126. <sect3 id="doc-standard.file-formatting.whitespace.trailing">
  127. <title>タグ内での空白</title>
  128. <para>
  129. <!-- TODO : to be translated -->
  130. Opening block tags should have no whitespace immediately following them other
  131. than line breaks (and indentation on the following line).
  132. </para>
  133. <programlisting language="xml"><![CDATA[
  134. <!-- NOT ALLOWED -->
  135. <sect1>WHITESPACE
  136. </sect1>
  137. ]]></programlisting>
  138. <para>
  139. Opening inline tags should have no whitespace immediately following them.
  140. </para>
  141. <programlisting language="xml"><![CDATA[
  142. <!-- NOT ALLOWED -->
  143. This is the class <classname> Zend_Class</classname>.
  144. <!-- OK -->
  145. This is the class <classname>Zend_Class</classname>.
  146. ]]></programlisting>
  147. <para>
  148. Closing block tags may be preceded by whitespace equivalent to the current
  149. indentation level, but no more than that amount.
  150. </para>
  151. <programlisting language="xml"><![CDATA[
  152. <!-- NOT ALLOWED -->
  153. <sect1>
  154. </sect1>
  155. <!-- OK -->
  156. <sect1>
  157. </sect1>
  158. ]]></programlisting>
  159. <para>
  160. Closing inline tags must not be preceded by any whitespace.
  161. </para>
  162. <programlisting language="xml"><![CDATA[
  163. <!-- NOT ALLOWED -->
  164. This is the class <classname>Zend_Class </classname>
  165. <!-- OK -->
  166. This is the class <classname>Zend_Class</classname>
  167. ]]></programlisting>
  168. </sect3>
  169. <sect3 id="doc-standard.file-formatting.whitespace.multiple-line-breaks">
  170. <title>複数行の切断</title>
  171. <para>
  172. 複数行内での、またはタグの間での切断は認められません。
  173. </para>
  174. <programlisting language="xml"><![CDATA[
  175. <!-- NOT ALLOWED -->
  176. <para>
  177. Some text...
  178. ... and more text
  179. </para>
  180. <para>
  181. Another paragraph.
  182. </para>
  183. <!-- OK -->
  184. <para>
  185. Some text...
  186. ... and more text
  187. </para>
  188. <para>
  189. Another paragraph.
  190. </para>
  191. ]]></programlisting>
  192. </sect3>
  193. <sect3 id="doc-standard.file-formatting.whitespace.tag-separation">
  194. <title>タグの間の分離</title>
  195. <para>
  196. 読みやすくするために、同じレベルのタグは空行で分離しなければいけません。
  197. </para>
  198. <programlisting language="xml"><![CDATA[
  199. <!-- NOT ALLOWED -->
  200. <para>
  201. Some text...
  202. </para>
  203. <para>
  204. More text...
  205. </para>
  206. <!-- OK -->
  207. <para>
  208. Some text...
  209. </para>
  210. <para>
  211. More text...
  212. </para>
  213. ]]></programlisting>
  214. <para>
  215. <!-- TODO : to be translated -->
  216. The first child tag should open directly below its parent, with no empty line
  217. between them; the last child tag should close directly before the closing tag of
  218. its parent.
  219. </para>
  220. <programlisting language="xml"><![CDATA[
  221. <!-- NOT ALLOWED -->
  222. <sect1>
  223. <sect2>
  224. </sect2>
  225. <sect2>
  226. </sect2>
  227. <sect2>
  228. </sect2>
  229. </sect1>
  230. <!-- OK -->
  231. <sect1>
  232. <sect2>
  233. </sect2>
  234. <sect2>
  235. </sect2>
  236. <sect2>
  237. </sect2>
  238. </sect1>
  239. ]]></programlisting>
  240. </sect3>
  241. </sect2>
  242. <sect2 id="doc-standard.file-formatting.program-listing">
  243. <title>プログラム・リスティング</title>
  244. <para>
  245. The opening <emphasis>&lt;programlisting&gt;</emphasis> tag must indicate the
  246. appropriate "language" attribute and be indented at the same level as its sibling
  247. blocks.
  248. </para>
  249. <programlisting language="xml"><![CDATA[
  250. <para>Sibling paragraph.</para>
  251. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  252. ]]></programlisting>
  253. <para>
  254. <acronym>CDATA</acronym> should be used around all program listings.
  255. </para>
  256. <para>
  257. <emphasis>&lt;programlisting&gt;</emphasis> sections must not add linebreaks or
  258. whitespace at the beginning or end of the section, as these are then represented in
  259. the final output.
  260. </para>
  261. <programlisting language="xml"><![CDATA[
  262. <!-- NOT ALLOWED -->
  263. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  264. $render = "xxx";
  265. ]]]]>&gt;<![CDATA[</programlisting>
  266. <!-- OK -->
  267. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  268. $render = "xxx";
  269. ]]]]>&gt;<![CDATA[</programlisting>
  270. ]]></programlisting>
  271. <para>
  272. Ending <acronym>CDATA</acronym> and <emphasis>&lt;programlisting&gt;</emphasis>
  273. tags should be on the same line, without any indentation.
  274. </para>
  275. <programlisting language="xml"><![CDATA[
  276. <!-- NOT ALLOWED -->
  277. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  278. $render = "xxx";
  279. ]]]]>&gt;<![CDATA[
  280. </programlisting>
  281. <!-- NOT ALLOWED -->
  282. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  283. $render = "xxx";
  284. ]]]]>&gt;<![CDATA[</programlisting>
  285. <!-- OK -->
  286. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  287. $render = "xxx";
  288. ]]]]>&gt;<![CDATA[</programlisting>
  289. ]]></programlisting>
  290. <para>
  291. The <emphasis>&lt;programlisting&gt;</emphasis> tag should contain the "language"
  292. attribute with a value appropriate to the contents of the program listing. Typical
  293. values include "css", "html", "ini", "javascript", "php", "text", and "xml".
  294. </para>
  295. <programlisting language="xml"><![CDATA[
  296. <!-- PHP -->
  297. <programlisting language="php">]]>&lt;<![CDATA[![CDATA[
  298. <!-- Javascript -->
  299. <programlisting language="javascript">]]>&lt;<![CDATA[![CDATA[
  300. <!-- XML -->
  301. <programlisting language="xml">]]>&lt;<![CDATA[![CDATA[
  302. ]]></programlisting>
  303. <para>
  304. For program listings containing only <acronym>PHP</acronym> code,
  305. <acronym>PHP</acronym> tags (e.g., "&lt;?php", "?&gt;") are not required, and
  306. should not be used. They simply clutter the narrative, and are implied by the use
  307. of the <emphasis>&lt;programlisting&gt;</emphasis> tag.
  308. </para>
  309. <programlisting language="xml"><![CDATA[
  310. <!-- NOT ALLOWED -->
  311. <programlisting language="php"]]>&lt;<![CDATA[![CDATA[<?php
  312. // ...
  313. ?>]]]]>&gt;<![CDATA[</programlisting>
  314. <programlisting language="php"]]>&lt;<![CDATA[![CDATA[
  315. <?php
  316. // ...
  317. ?>
  318. ]]]]>&gt;<![CDATA[</programlisting>
  319. ]]></programlisting>
  320. <para>
  321. Line lengths within program listings should follow the <link
  322. linkend="coding-standard.php-file-formatting.max-line-length">coding standards
  323. recommendations</link>.
  324. </para>
  325. <para>
  326. Refrain from using <methodname>require_once()</methodname>,
  327. <methodname>require()</methodname>, <methodname>include_once()</methodname>, and
  328. <methodname>include()</methodname> calls within <acronym>PHP</acronym> listings.
  329. They simply clutter the narrative, and are largely obviated when using an
  330. autoloader. Use them only when they are essential to the example.
  331. </para>
  332. <note>
  333. <title>ショートタグを決して使わないで下さい</title>
  334. <para>
  335. Short tags (e.g., "&lt;?", "&lt;?=") should never be used within
  336. <emphasis>programlisting</emphasis> or the narrative of a document.
  337. </para>
  338. </note>
  339. </sect2>
  340. <sect2 id="doc-standard.file-formatting.inline-tags">
  341. <title>特殊なインラインタグの注意</title>
  342. <sect3 id="doc-standard.file-formatting.inline-tags.classname">
  343. <title>classname</title>
  344. <para>
  345. The tag <emphasis>&lt;classname&gt;</emphasis> must be used each time a class
  346. name is represented by itself; it should not be used when combined with a
  347. method name, variable name, or constant, and no other content is allowed within
  348. the tag.
  349. </para>
  350. <programlisting language="xml"><![CDATA[
  351. <para>
  352. The class <classname>Zend_Class</classname>.
  353. </para>
  354. ]]></programlisting>
  355. </sect3>
  356. <sect3 id="doc-standard.file-formatting.inline-tags.varname">
  357. <title>varname</title>
  358. <para>
  359. Variables must be wrapped in the <emphasis>&lt;varname&gt;</emphasis> tag.
  360. Variables must be written using the "$" sigil. No other content is allowed
  361. within this tag, unless a class name is used, which indicates a class variable.
  362. </para>
  363. <programlisting language="xml"><![CDATA[
  364. <para>
  365. The variable <varname>$var</varname> and the class variable
  366. <varname>Zend_Class::$var</varname>.
  367. </para>
  368. ]]></programlisting>
  369. </sect3>
  370. <sect3 id="doc-standard.file-formatting.inline-tags.methodname">
  371. <title>methodname</title>
  372. <para>
  373. Methods must be wrapped in the <emphasis>&lt;methodname&gt;</emphasis> tag.
  374. Methods must either include the full method signature or at the least a pair of
  375. closing parentheses (e.g., "()"). No other content is allowed within this tag,
  376. unless a class name is used, which indicates a class method.
  377. </para>
  378. <programlisting language="xml"><![CDATA[
  379. <para>
  380. The method <methodname>foo()</methodname> and the class method
  381. <methodname>Zend_Class::foo()</methodname>. A method with a full signature:
  382. <methodname>foo($bar, $baz)</methodname>
  383. </para>
  384. ]]></programlisting>
  385. </sect3>
  386. <sect3 id="doc-standard.file-formatting.inline-tags.constant">
  387. <title>constant</title>
  388. <para>
  389. Use the <emphasis>&lt;constant&gt;</emphasis> tag when denoting constants.
  390. Constants must be written in <acronym>UPPERCASE</acronym>. No other content is
  391. allowed within this tag, unless a class name is used, which indicates a class
  392. constant.
  393. </para>
  394. <programlisting language="xml"><![CDATA[
  395. <para>
  396. The constant <constant>FOO</constant> and the class constant
  397. <constant>Zend_Class::FOO</constant>.
  398. </para>
  399. ]]></programlisting>
  400. </sect3>
  401. <sect3 id="doc-standard.file-formatting.inline-tags.filename">
  402. <title>filename</title>
  403. <para>
  404. Filenames and paths must be wrapped in the
  405. <emphasis>&lt;filename&gt;</emphasis> tag. No other content is allowed in this
  406. tag.
  407. </para>
  408. <programlisting language="xml"><![CDATA[
  409. <para>
  410. The filename <filename>application/Bootstrap.php</filename>.
  411. </para>
  412. ]]></programlisting>
  413. </sect3>
  414. <sect3 id="doc-standard.file-formatting.inline-tags.command">
  415. <title>command</title>
  416. <para>
  417. Commands, shell scripts, and program calls must be wrapped in the
  418. <emphasis>&lt;command&gt;</emphasis> tag. If the command includes arguments,
  419. these should also be included within the tag.
  420. </para>
  421. <programlisting language="xml"><![CDATA[
  422. <para>
  423. Execute <command>zf.sh create project</command>.
  424. </para>
  425. ]]></programlisting>
  426. </sect3>
  427. <sect3 id="doc-standard.file-formatting.inline-tags.code">
  428. <title>code</title>
  429. <para>
  430. Usage of the <emphasis>&lt;code&gt;</emphasis> tag is discouraged, in favor of
  431. the other inline tasks discussed previously.
  432. </para>
  433. </sect3>
  434. </sect2>
  435. <sect2 id="doc-standard.file-formatting.block-tags">
  436. <title>特殊なブロックタグの注意</title>
  437. <sect3 id="doc-standard.file-formatting.block-tags.title">
  438. <title>title</title>
  439. <para>
  440. <emphasis>&lt;title&gt;</emphasis> タグで他のタグを保持してはいけません。
  441. </para>
  442. <programlisting language="xml"><![CDATA[
  443. <!-- NOT ALLOWED -->
  444. <title>Using <classname>Zend_Class</classname></title>
  445. <!-- OK -->
  446. <title>Using Zend_Class</title>
  447. ]]></programlisting>
  448. </sect3>
  449. </sect2>
  450. </sect1>
  451. <sect1 id="doc-standard.recommendations">
  452. <title>推奨事項</title>
  453. <sect2 id="doc-standard.recommendations.editors">
  454. <title>自動でフォーマットしないエディタを使ってください</title>
  455. <para>
  456. ドキュメンテーションを編集するために、
  457. 一般的に、正式な<acronym>XML</acronym>エディタを使用するべきではありません。
  458. そのようなエディタは、通常、それらの独自の標準に合わせるために、
  459. 既存のドキュメントを自動的にフォーマットします。
  460. および/または、docbook 標準に厳密には従いません。
  461. 例えば、それらは<acronym>CDATA</acronym>タグを消したり、
  462. 4スペースの間隔をタブや2スペースに変えたりすることを経験しています。
  463. </para>
  464. <para>
  465. <!-- TODO : to be translated -->
  466. The style guidelines were written in large part to assist translators in recognizing
  467. the lines that have changed using normal <command>diff</command> tools.
  468. Autoformatting makes this process more difficult.
  469. </para>
  470. </sect2>
  471. <sect2 id="doc-standard.recommendations.images">
  472. <title>イメージを使ってください</title>
  473. <para>
  474. Good images and diagrams can improve readability and comprehension. Use them
  475. whenever they will assist in these goals. Images should be placed in the
  476. <filename>documentation/manual/en/figures/</filename> directory, and be named after
  477. the section identifier in which they occur.
  478. </para>
  479. </sect2>
  480. <sect2 id="doc-standard.recommendations.examples">
  481. <title>ケースの例を使ってください</title>
  482. <para>
  483. Look for good use cases submitted by the community, especially those posted in
  484. proposal comments or on one of the mailing lists. Examples often illustrate usage
  485. far better than the narrative does.
  486. </para>
  487. <para>
  488. When writing your examples for inclusion in the manual, follow
  489. all coding standards and documentation standards.
  490. </para>
  491. </sect2>
  492. <sect2 id="doc-standard.recommendations.phpdoc">
  493. <title>phpdocの内容を繰り返すことを避けてください</title>
  494. <para>
  495. The manual is intended to be a reference guide for end-user usage. Replicating
  496. the phpdoc documentation for internal-use components and classes is not wanted, and
  497. the narrative should be focussed on usage, not the internal workings. In any case,
  498. at this time, we would like the documentation teams to focus on translating the
  499. English manual, not the phpdoc comments.
  500. </para>
  501. </sect2>
  502. <sect2 id="doc-standard.recommendations.links">
  503. <title>リンクを使ってください</title>
  504. <para>
  505. ドキュメントを繰り返す代わりに、
  506. マニュアルの他のセクションや外部のソースにリンクしてください。
  507. </para>
  508. <para>
  509. マニュアルの他のセクションへのリンクを
  510. <emphasis>&lt;xref&gt;</emphasis>タグ(セクションのタイトルをリンク・テキストの代わりにします)
  511. または<emphasis>&lt;link&gt;</emphasis>タグ(リンクのテキストを用意しなければいけません)
  512. のどちらかを使って実施できるでしょう。
  513. </para>
  514. <programlisting language="xml"><![CDATA[
  515. <para>
  516. "Xref" links to a section: <xref
  517. linkend="doc-standard.recommendations.links" />.
  518. </para>
  519. <para>
  520. "Link" links to a section, using descriptive text: <link
  521. linkend="doc-standard.recommendations.links">documentation on
  522. links</link>.
  523. </para>
  524. ]]></programlisting>
  525. <para>
  526. 外部リソースにリンクするには、<emphasis>&lt;ulink&gt;</emphasis>を使ってください。
  527. </para>
  528. <programlisting language="xml"><![CDATA[
  529. <para>
  530. The <ulink url="http://framework.zend.com/">Zend Framework site</ulink>.
  531. </para>
  532. ]]></programlisting>
  533. </sect2>
  534. </sect1>
  535. </appendix>