|
1 | 1 | .. _internals-documentation:
|
2 | 2 |
|
3 |
| -How the Django documentation works |
4 |
| -================================== |
| 3 | +Django ドキュメントの仕組み |
| 4 | +============================ |
5 | 5 |
|
6 | 6 | :revision-up-to: 8961 (1.0)
|
7 | 7 |
|
8 |
| -\... and how to contribute. |
| 8 | +\... と、ドキュメント作業への貢献方法 |
9 | 9 |
|
10 |
| -Django's documentation uses the Sphinx__ documentation system, which in turn is |
11 |
| -based on docutils__. The basic idea is that lightly-formatted plain-text |
12 |
| -documentation is transformed into HTML, PDF, and any other output format. |
| 10 | +Django のドキュメントは Sphinx__ ドキュメンテーションシステムを使っています。 |
| 11 | +Sphinx__ は docutils__ に基づいて作られています。 docutils は、簡単な書式の |
| 12 | +プレーンテキストを、 HTML や PDF その他の様々な出力形式で簡単に扱えるように |
| 13 | +することを念頭に置いて作られています。 |
13 | 14 |
|
14 | 15 | __ http://sphinx.pocoo.org/
|
15 | 16 | __ http://docutils.sf.net/
|
16 | 17 |
|
17 |
| -To actually build the documentation locally, you'll currently need to install |
18 |
| -Sphinx -- ``easy_install Sphinx`` should do the trick. |
| 18 | +ドキュメントを実際に手元でビルドするには、現状では Sphinx をインストールす |
| 19 | +る必要があります。インストールは ``easy_install Sphinx`` でできます。 |
19 | 20 |
|
20 |
| -Then, building the html is easy; just ``make html`` from the ``docs`` directory. |
| 21 | +さて、 html のビルドは簡単です。単に ``docs`` ディレクトリで ``make html`` |
| 22 | +を実行するだけです。 |
21 | 23 |
|
22 |
| -To get started contributing, you'll want to read the `ReStructuredText |
23 |
| -Primer`__. After that, you'll want to read about the `Sphinx-specific markup`__ |
24 |
| -that's used to manage metadata, indexing, and cross-references. |
| 24 | +ドキュメント作業に貢献したいなら、まず `ReStructuredText Primer`__ を読みま |
| 25 | +しょう。その後 `Sphinx 固有のマークアップ`__ の説明を読んで、メタデータやイ |
| 26 | +ンデクス、相互参照の方法を学ぶとよいでしょう。 |
25 | 27 |
|
26 | 28 | __ http://sphinx.pocoo.org/rest.html
|
27 | 29 | __ http://sphinx.pocoo.org/markup/
|
28 | 30 |
|
29 |
| -The main thing to keep in mind as you write and edit docs is that the more |
30 |
| -semantic markup you can add the better. So:: |
| 31 | +ドキュメントを書いたり編集したりする上で覚えておかねばならないのは、よりセ |
| 32 | +マンティックなマークアップを使う方がよい、ということです。従って:: |
31 | 33 |
|
32 | 34 | Add ``django.contrib.auth`` to your ``INSTALLED_APPS``...
|
33 |
| - |
34 |
| -Isn't nearly as helpful as:: |
| 35 | + |
| 36 | +とするよりも:: |
35 | 37 |
|
36 | 38 | Add :mod:`django.contrib.auth` to your :setting:`INSTALLED_APPS`...
|
37 |
| - |
38 |
| -This is because Sphinx will generate proper links for the later, which greatly |
39 |
| -helps readers. There's basically no limit to the amount of useful markup you can |
40 |
| -add. |
41 | 39 |
|
42 |
| -Django-specific markup |
43 |
| ----------------------- |
| 40 | +と書いた方が便利なのです。なぜなら、後者のマークアップの場合、 Sphinx が適 |
| 41 | +切なリンクを生成するため、ドキュメントの読み手にとって非常に助かるからです。 |
| 42 | +制限はありません。可能な限り便利なマークアップを使ってください。 |
44 | 43 |
|
45 |
| -Besides the `Sphinx built-in markup`__, Django's docs defines some extra description units: |
| 44 | +Django 固有のマークアップ |
| 45 | +-------------------------- |
| 46 | + |
| 47 | +`Sphinx の組み込みマークアップ`__ の他に、Django ドキュメントではいくつか追 |
| 48 | +加で表記単位 (description unit) を定義しています: |
46 | 49 |
|
47 | 50 | __ http://sphinx.pocoo.org/markup/desc.html
|
48 | 51 |
|
49 |
| - * Settings:: |
| 52 | + * 設定:: |
50 | 53 |
|
51 | 54 | .. setting:: INSTALLED_APPS
|
52 | 55 |
|
53 |
| - To link to a setting, use ``:setting:`INSTALLED_APPS```. |
| 56 | + リンクするには、 ``:setting:`INSTALLED_APPS``` としてください。 |
54 | 57 |
|
55 |
| - * Template tags:: |
| 58 | + * テンプレートタグ:: |
56 | 59 |
|
57 | 60 | .. templatetag:: regroup
|
58 | 61 |
|
59 |
| - To link, use ``:ttag:`regroup```. |
| 62 | + タグの説明にリンクするには ``:ttag:`regroup``` としてください。 |
60 | 63 |
|
61 |
| - * Template filters:: |
| 64 | + * テンプレートフィルタ:: |
62 | 65 |
|
63 | 66 | .. templatefilter:: linebreaksbr
|
64 | 67 |
|
65 |
| - To link, use ``:tfilter:`linebreaksbr```. |
| 68 | + リンクするには ``:tfilter:`linebreaksbr``` としてください。 |
66 | 69 |
|
67 |
| - * Field lookups (i.e. ``Foo.objects.filter(bar__exact=whatever)``):: |
| 70 | + * フィールド照合 (``Foo.objects.filter(bar__exact=whatever)`` など):: |
68 | 71 |
|
69 | 72 | .. fieldlookup:: exact
|
70 | 73 |
|
71 |
| - To link, use ``:lookup:`exact```. |
| 74 | + リンクするには ``:lookup:`exact``` としてください。 |
72 | 75 |
|
73 |
| - * ``django-admin`` commands:: |
| 76 | + * ``django-admin`` コマンド:: |
74 | 77 |
|
75 | 78 | .. django-admin:: syncdb
|
76 | 79 |
|
77 |
| - To link, use ``:djadmin:`syncdb```. |
| 80 | + リンクするには ``:djadmin:`syncdb``` としてください。 |
78 | 81 |
|
79 |
| - * ``django-admin`` command-line options:: |
| 82 | + * ``django-admin`` コマンドラインオプション:: |
80 | 83 |
|
81 | 84 | .. django-admin-option:: --traceback
|
82 | 85 |
|
83 |
| - To link, use ``:djadminopt:`--traceback```. |
| 86 | + リンクするには ``:djadminopt:`--traceback``` としてください。 |
84 | 87 |
|
85 |
| -An example |
86 |
| ----------- |
| 88 | +例 |
| 89 | +---- |
87 | 90 |
|
88 |
| -For a quick example of how it all fits together, check this out: |
| 91 | +マークアップの簡単な例を以下にまとめました: |
89 | 92 |
|
90 |
| - * First, the ``ref/settings.txt`` document starts out like this:: |
| 93 | + * まず、 ``ref/settings.txt`` ドキュメントを見てみましょう。このドキュ |
| 94 | + メントは以下のような内容から始まっています:: |
91 | 95 |
|
92 | 96 | .. _ref-settings:
|
93 | 97 |
|
94 |
| - Available settings |
95 |
| - ================== |
| 98 | + settings に設定できる値 |
| 99 | + ========================== |
96 | 100 |
|
97 | 101 | ...
|
98 | 102 |
|
99 |
| - * Next, if you look at the ``topics/settings.txt`` document, you can see how |
100 |
| - a link to ``ref/settings`` works:: |
| 103 | + * ``topics/settings.txt`` ドキュメントを見ると、 ``ref/settings`` への |
| 104 | + リンクがどのように書かれているか分かります:: |
101 | 105 |
|
102 |
| - Available settings |
103 |
| - ================== |
| 106 | + 利用可能な設定 |
| 107 | + ============== |
104 | 108 |
|
105 |
| - For a full list of available settings, see the :ref:`settings reference |
106 |
| - <ref-settings>`. |
| 109 | + 利用可能な設定は :ref:`setting リファレンス <ref-settings>` を参照 |
| 110 | + してください。 |
107 | 111 |
|
108 |
| - * Next, notice how the settings (right now just the top few) are annotated:: |
| 112 | + * 設定項目をどのように表記しているかを見てみましょう:: |
109 | 113 |
|
110 | 114 | .. setting:: ADMIN_FOR
|
111 | 115 |
|
112 | 116 | ADMIN_FOR
|
113 |
| - --------- |
114 |
| - |
115 |
| - Default: ``()`` (Empty tuple) |
116 |
| - |
117 |
| - Used for admin-site settings modules, this should be a tuple of settings |
118 |
| - modules (in the format ``'foo.bar.baz'``) for which this site is an |
119 |
| - admin. |
| 117 | + --------- |
120 | 118 |
|
121 |
| - The admin site uses this in its automatically-introspected |
122 |
| - documentation of models, views and template tags. |
| 119 | + デフォルト値: ``()`` (空のタプル) |
| 120 | + admin 用サイトの設定モジュールで設定します。このサイトの admin を他 |
| 121 | + のサイトの admin にする場合、設定モジュールを (``'foo.bar.baz'`` の |
| 122 | + 形式のタプルで) 指定します。 |
123 | 123 |
|
124 |
| - This marks up the following header as the "canonical" target for the |
125 |
| - setting ``ADMIN_FOR`` This means any time I talk about ``ADMIN_FOR``, I |
126 |
| - can reference it using ``:setting:`ADMIN_FOR```. |
127 |
| - |
128 |
| -That's basically how everything fits together. |
| 124 | + admin サイトはこの変数を使って、モデルやビュー、テンプレートタグの |
| 125 | + ドキュメントに対するイントロスペクションを自動的に行います。 |
| 126 | + |
| 127 | + この ``.. settings::`` の部分で、 ``ADMIN_FOR`` の「正しい」ターゲッ |
| 128 | + トとしてを定義しています。これで、 ``ADMIN_FOR`` について説明するとき |
| 129 | + に、 ``:setting:`ADMIN_FOR``` を使って参照できます。 |
| 130 | + |
| 131 | +このようにして、お互いの参照を解決します。 |
129 | 132 |
|
130 | 133 | TODO
|
131 | 134 | ----
|
132 | 135 |
|
133 |
| -The work is mostly done, but here's what's left, in rough order of priority. |
| 136 | +ドキュメントの整備はほぼ終っていますが、まだ、ほぼ以降に挙げる順番にやらね |
| 137 | +ばならないことが残っています。 |
134 | 138 |
|
135 |
| - * Fix up generic view docs: adapt Chapter 9 of the Django Book (consider |
136 |
| - this TODO item my permission and license) into |
137 |
| - ``topics/generic-views.txt``; remove the intro material from |
138 |
| - ``ref/generic-views.txt`` and just leave the function reference. |
| 139 | + * 汎用ビューの部分を修正します。 Django Book の 9 章を |
| 140 | + ``topics/generic-views.txt`` にもってきて (この項目をもって、著者の許 |
| 141 | + 可とライセンス許諾に代えます)、 ``ref/generic-views.txt`` の導入部分 |
| 142 | + を削除し、関数のリファレンスだけにします。 |
139 | 143 |
|
140 |
| - * Change the "Added/changed in development version" callouts to proper |
141 |
| - Sphinx ``.. versionadded::`` or ``.. versionchanged::`` directives. |
| 144 | + * 「開発版で追加/変更された機能」の部分を、全て Sphinx の |
| 145 | + ``.. versionadded::`` および ``.. versionchanged::`` ディレクティブに |
| 146 | + 置き換えます。 |
142 | 147 |
|
143 |
| - * Check for and fix malformed links. Do this by running ``make linkcheck`` |
144 |
| - and fix all of the 300+ errors/warnings. |
| 148 | + * おかしなリンクをチェックして修正します。 ``make linkcheck`` を実行し |
| 149 | + て、 300 個以上出るエラーや警告メッセージを全て修正します。 |
145 | 150 |
|
146 |
| - In particular, look at all the relative links; these need to be |
147 |
| - changed to proper references. |
| 151 | + 特に、相対リンクを全て調べる必要があります。これらは正しい参照に変更 |
| 152 | + せねばなりません。 |
148 | 153 |
|
149 |
| - * Most of the various ``index.txt`` documents have *very* short or even |
150 |
| - non-existent intro text. Each of those documents needs a good short intro |
151 |
| - the content below that point. |
| 154 | + * ほとんどの ``index.txt`` ドキュメントに、肝心の説明文が *とても* わず |
| 155 | + かしかないか、まったくありません。それぞれに、各階層下に収められてい |
| 156 | + るコンテンツのよい説明文が必要です。 |
152 | 157 |
|
153 |
| - * The glossary is very perfunctory. It needs to be filled out. |
| 158 | + * 用語集がいい加減すぎます。もっと内容を濃くする必要があります。 |
154 | 159 |
|
155 |
| - * Add more metadata targets: there's lots of places that look like:: |
| 160 | + * メタデータターゲットをもっと増やします。まだ:: |
156 | 161 |
|
157 | 162 | ``File.close()``
|
158 | 163 | ~~~~~~~~~~~~~~~~
|
159 | 164 |
|
160 |
| - \... these should be:: |
| 165 | + のような部分がたくさんあり、以下のように書き直さねばなりません:: |
161 | 166 |
|
162 | 167 | .. method:: File.close()
|
163 | 168 |
|
164 |
| - That is, use metadata instead of titles. |
| 169 | + つまり、タイトルではなくメタデータを使わねばなりません。 |
165 | 170 |
|
166 |
| - * Add more links -- nearly everything that's an inline code literal |
167 |
| - right now can probably be turned into a xref. |
| 171 | + * リンクを追加します。現状のインラインコードリテラルは、ほぼ全て相互参 |
| 172 | + 照に変更できます。 |
168 | 173 |
|
169 |
| - See the ``literals_to_xrefs.py`` file in ``_ext`` -- it's a shell script |
170 |
| - to help do this work. |
| 174 | + ``_ext`` 以下にある ``literals_to_xrefs.py`` ファイルを参照してくださ |
| 175 | + い。このシェルスクリプトを使えば、作業が楽になります。 |
171 | 176 |
|
172 |
| - This will probably be a continuing, never-ending project. |
| 177 | + おそらく終らない、地道な作業になるでしょう。 |
173 | 178 |
|
174 |
| - * Add `info field lists`__ where appropriate. |
| 179 | + * 適切な `info フィールドリスト`__ を追加する必要があります。 |
175 | 180 |
|
176 | 181 | __ http://sphinx.pocoo.org/markup/desc.html#info-field-lists
|
177 | 182 |
|
178 |
| - * Add ``.. code-block:: <lang>`` to literal blocks so that they get |
179 |
| - highlighted. |
| 183 | + * 色づけ表示の必要なリテラルブロックに ``.. code-block:: <lang>`` を付 |
| 184 | + 加する必要があります。 |
180 | 185 |
|
181 |
| -Hints |
182 |
| ------ |
| 186 | +ヒント |
| 187 | +------- |
183 | 188 |
|
184 |
| -Some hints for making things look/read better: |
| 189 | +読みやすいドキュメントにするためのヒントをいくつか紹介しましょう: |
185 | 190 |
|
186 |
| - * Whenever possible, use links. So, use ``:setting:`ADMIN_FOR``` instead of |
187 |
| - ````ADMIN_FOR````. |
| 191 | + * 可能なかぎり、リンクを使いましょう。例えば、 ````ADMIN_FOR```` は |
| 192 | + ``:setting:`ADMIN_FOR``` にしましょう。 |
188 | 193 |
|
189 |
| - * Some directives (``.. setting::``, for one) are prefix-style directives; |
190 |
| - they go *before* the unit they're describing. These are known as |
191 |
| - "crossref" directives. Others (``.. class::``, e.g.) generate their own |
192 |
| - markup; these should go inside the section they're describing. These are |
193 |
| - called "description units". |
| 194 | + * ディレクティブの中には、プレフィクススタイルのもの (``.. setting::`` |
| 195 | + など)あります。プレフィクススタイルのディレクティブは、記述対象のブロッ |
| 196 | + クの *前* に置かねばなりません。その他 (``.. class::`` など) は独自の |
| 197 | + マークアップを生成します。その他のディレクティブは、記述対象のセクショ |
| 198 | + ンの中に置かねばなりません。こうしたディレクティブは「記述単位 |
| 199 | + (description unit)」と呼びます。 |
194 | 200 |
|
195 |
| - You can tell which are which by looking at in :file:`_ext/djangodocs.py`; |
196 |
| - it registers roles as one of the other. |
| 201 | + どのディレクティブがどちらのタイプは、 :file:`_ext/djangodocs.py` を |
| 202 | + 参照してください。このファイルの中で、それぞれのロールを登録していま |
| 203 | + す。 |
197 | 204 |
|
198 |
| - * When referring to classes/functions/modules, etc., you'll want to use the |
199 |
| - fully-qualified name of the target |
200 |
| - (``:class:`django.contrib.contenttypes.models.ContentType```). |
| 205 | + * クラスや関数、モジュールなどを参照するときは、完全指定の名前 |
| 206 | + (``:class:`django.contrib.contenttypes.models.ContentType```)を使うと |
| 207 | + よいでしょう。 |
201 | 208 |
|
202 |
| - Since this doesn't look all that awesome in the output -- it shows the |
203 |
| - entire path to the object -- you can prefix the target with a ``~`` |
204 |
| - (that's a tilde) to get just the "last bit" of that path. So |
205 |
| - ``:class:`~django.contrib.contenttypes.models.ContentType``` will just |
206 |
| - display a link with the title "ContentType". |
| 209 | + 完全指定の名前を使っただけでは、出力はさほどきれいにならないでしょう。 |
| 210 | + というのも、オブジェクトの全てのパスが表示されてしまうからです。 |
| 211 | + ターゲットの先頭にチルダ (``~``) を付けると、パスの「最後の部分」だけ |
| 212 | + が表示されます。従って、 |
| 213 | + ``:class:`~django.contrib.contenttypes.models.ContentType``` とすると、 |
| 214 | + 単に "ContentType" と書かれたリンクを生成します。 |
| 215 | + |
0 commit comments