Skip to content

Commit 2788206

Browse files
committed
translation updates.
1 parent 4b6307c commit 2788206

File tree

12 files changed

+281
-326
lines changed

12 files changed

+281
-326
lines changed

howto/custom-template-tags.txt

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,33 @@
66

77
:revision-up-to: 8961 (1.0)
88

9-
.. TBD
10-
11-
12-
Introduction
9+
はじめに
1310
============
1411

15-
Django's template system comes a wide variety of :ref:`built-in tags and filters
16-
<ref-templates-builtins>` designed to address the presentation logic needs of
17-
your application. Nevertheless, you may find yourself needing functionality that
18-
is not covered by the core set of template primitives. You can extend the
19-
template engine by defining custom tags and filters using Python, and then make
20-
them available to your templates using the ``{% load %}`` tag.
21-
22-
Code layout
23-
-----------
24-
25-
Custom template tags and filters must live inside a Django app. If they relate
26-
to an existing app it makes sense to bundle them there; otherwise, you should
27-
create a new app to hold them.
28-
29-
The app should contain a ``templatetags`` directory, at the same level as
30-
``models.py``, ``views.py``, etc. If this doesn't already exist, create it -
31-
don't forget the ``__init__.py`` file to ensure the directory is treated as a
32-
Python package.
33-
34-
Your custom tags and filters will live in a module inside the ``templatetags``
35-
directory. The name of the module file is the name you'll use to load the tags
36-
later, so be careful to pick a name that won't clash with custom tags and
37-
filters in another app.
12+
Django テンプレートシステムには、広範な :ref:`組み込みタグとフィルタ
13+
<ref-templates-builtins>` が付属していて、アプリケーションのプレゼンテーショ
14+
ンロジックに纏わる問題を解決できます。とはいえ、コアのテンプレートタグ
15+
プリミティブだけでは、要求を満たせない場合もあります。そういう場合のために、
16+
テンプレートエンジンを拡張できます。Python で自作のタグやフィルタを書き、
17+
テンプレート上で ``{% load %}`` タグを使って使えるのです。
18+
19+
コードの配置
20+
-------------
21+
22+
カスタムのテンプレートタグやフィルタは Django のアプリケーション内に置きま
23+
す。既存のアプリケーションに関連があるのなら、そのアプリケーションにバンド
24+
ルすればよいでしょう。そうでなければ、コードを入れておくための新たなアプリ
25+
ケーションを作成します。
26+
27+
アプリケーション内には、 ``templatetags`` ディレクトリを置かねばなりません。
28+
このディレクトリは、 ``models.py`` や ``views.py`` などと同じ階層に置きます。
29+
``templatetags`` がなければ、作成してください。ディレクトリ内に
30+
``__init__.py`` を置いて、パッケージ化するのを忘れないでください。
31+
32+
カスタムのタグやフィルタは、 ``templatetags`` ディレクトリの下に置きます。
33+
モジュールファイルの名前は、あとでタグをロードするときに使う名前にします。
34+
ですから、他のアプリケーションのカスタムタグやフィルタと名前が衝突しないよ
35+
う、よく注意して名前を決めましょう。
3836

3937
``poll_extras.py`` という名前のファイルに自作のタグ/フィルタを入れているの
4038
なら、アプリケーションのレイアウトは以下のようになるでしょう::

howto/deployment/fastcgi.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,8 @@ URL を ``mysite.fcgi`` (または ``FastCGIExternalServer`` ディレクティ
243243

244244
.. _mod_rewrite: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
245245

246-
.. TBD
247-
248-
Django will automatically use the pre-rewrite version of the URL when
249-
constructing URLs with the ``{% url %}`` template tag (and similar methods).
250-
246+
Django は、 ``{% url %}`` テンプレートタグ (や、同様のメソッド) で URL を構
247+
築する際、自動的にリライト前の URL を使います。
251248

252249
.. _lighttpd setup:
253250

howto/error-reporting.txt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55

66
:revision-up-to: 8961 (1.0)
77

8-
.. TBD
8+
サイトを公開しているときには、 :setting:`DEBUG` を常に切りましょう。
9+
:setting:`DEBUG` を切ると、サーバの動作は軽くなり、エラーページを介して悪意
10+
あるユーザにアプリケーションの詳細が漏れてしまうのを防げます。
911

10-
When you're running a public site you should always turn off the
11-
:setting:`DEBUG` setting. That will make your server run much faster, and will
12-
also prevent malicious users from seeing details of your application that can be
13-
revealed by the error pages.
14-
15-
However, running with :setting:`DEBUG` set to ``False`` means you'll never see
16-
errors generated by your site -- everyone will just see your public error pages.
17-
You need to keep track of errors that occur in deployed sites, so Django can be
18-
configured to email you details of those errors.
12+
その代わり、 :setting:`DEBUG` を ``False`` にすると、サイト上で発生したエラー
13+
を一切表示できません。ユーザはみな、公開用に作られたエラーページを見るだけ
14+
です。実運用のサイトで発生したエラーを追跡したい場合のために、 Django はエ
15+
ラーの詳細をメールで送信するように設定できます。
1916

2017
.. _Server errors:
2118

@@ -64,11 +61,9 @@ Django は、サイトのリンクが切れている (404 "page not found") 時
6461
この機能を無効にしたければ、 :setting:`SEND_BROKEN_LINK_EMAILS` を
6562
``False`` に設定してください。
6663

67-
.. TBD
68-
6964
.. seealso::
7065

71-
You can also set up custom error reporting by writing a custom piece of
72-
:ref:`exception middleware <exception-middleware>`. If you do write custom
73-
error handling, it's a good idea to emulate Django's built-in error handling
74-
and only report/log errors if :setting:`DEBUG` is ``False``.
66+
自作の :ref:`例外ミドルウェア <exception-middleware>` を書けば、エラー
67+
レポートを自作できます。エラー処理をカスタマイズしたければ、 Django 組
68+
み込みのエラー処理をエミュレートして、 :setting:`DEBUG` が ``False`` の
69+
ときだけ、レポートやログ記録を行うとよいでしょう。

ref/index.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
.. _ref-index:
22

3-
API Reference
4-
=============
3+
API リファレンス
4+
===================
55

66
:revision-up-to: 8961 (1.0)
77

8-
.. TBD
9-
108
.. toctree::
119
:maxdepth: 1
1210

ref/models/querysets.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ QuerySet API リファレンス
99

1010
.. currentmodule:: django.db.models
1111

12+
.. TBD
13+
1214
This document describes the details of the ``QuerySet`` API. It builds on the
1315
material presented in the :ref:`model <topics-db-models>` and `database query
1416
<topics-db-queries>` guides, so you'll probably want to read and understand

ref/settings.txt

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ DATABASE_ENGINE
161161
クエンドは、 ``'postgresql_psycopg2'``, ``'postgresql'``, ``'mysql'``,
162162
``'sqlite3'``, ``'oracle'`` です。
163163

164-
.. TBD
164+
.. versionchanged:: 1.0
165165

166-
In the Django development version, you can use a database backend that doesn't
167-
ship with Django by setting ``DATABASE_ENGINE`` to a fully-qualified path (i.e.
168-
``mypackage.backends.whatever``). Writing a whole new database backend from
169-
scratch is left as an exercise to the reader; see the other backends for
170-
examples.
166+
Django 1.0 から、 Django に組み込まれていないデータベースバックエンドを
167+
組み込むために、 ``DATABASE_ENGINE`` にバックエンドモジュールの完全指定
168+
パス (例えば ``mypackage.backends.whatever``) を指定できます。全く新し
169+
いデータベースバックエンドの作成は、読者の皆さんに委ねます。他のバック
170+
エンドの例を参照してください。
171171

172172
.. setting:: DATABASE_HOST
173173

@@ -331,12 +331,11 @@ DEFAULT_CONTENT_TYPE
331331
DEFAULT_FILE_STORAGE
332332
--------------------
333333

334-
.. TBD
334+
デフォルト値: ``django.core.files.storage.FileSystemStorage``
335335

336-
Default: ``django.core.files.storage.FileSystemStorage``
337-
338-
Default file storage class to be used for any file-related operations that don't
339-
specify a particular storage system. See :ref:`topics-files`.
336+
特定のストレージシステムに依存せずにファイル関連の操作を行うときに使う、
337+
デフォルトのファイルストレージクラスです。 :ref:`topics-files` を参照してく
338+
ださい。
340339

341340
DEFAULT_FROM_EMAIL
342341
------------------
@@ -550,12 +549,9 @@ FORCE_SCRIPT_NAME
550549

551550
デフォルト値: ``None``
552551

553-
.. TBD
554-
555-
If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
556-
environment variable in any HTTP request. This setting can be used to override
557-
the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
558-
of the preferred value or not supplied at all.
552+
``None`` に指定すると、 HTTMP リクエストの ``SCRIPT_NAME`` 環境変数の代わり
553+
に指定値を使います。この設定は、サーバが指定する ``SCRIPT_NAME`` の内容を上
554+
書きしたり、 ``SCRIPT_NAME`` を空にしたりするために使えます。
559555

560556
.. setting:: IGNORABLE_404_ENDS
561557

@@ -864,14 +860,6 @@ Django で作られたページに空でないリファラつきで訪問した
864860
``IGNORABLE_404_STARTS``, ``IGNORABLE_404_ENDS`` および
865861
:ref:`howto-error-reporting` も参照してください。
866862

867-
.. TBD
868-
869-
Whether to send an e-mail to the ``MANAGERS`` each time somebody visits a
870-
Django-powered page that is 404ed with a non-empty referer (i.e., a broken
871-
link). This is only used if ``CommonMiddleware`` is installed (see
872-
. See also ``IGNORABLE_404_STARTS``,
873-
``IGNORABLE_404_ENDS`` and .
874-
875863
.. setting:: SERIALIZATION_MODULES
876864

877865
SERIALIZATION_MODULES

releases/index.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _releases-index:
22

3-
Release notes
4-
=============
3+
リリースノート
4+
===============
55

66
:revision-up-to: 8961 (1.0)
77

topics/cache.txt

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,10 @@ memcached インスタンスでキャッシュを共有しています::
183183

184184
CACHE_BACKEND = 'locmem:///'
185185

186-
.. TBD
187-
188-
Note that each process will have its own private cache instance, which means no
189-
cross-process caching is possible. This obviously also means the local memory
190-
cache isn't particularly memory-efficient, so it's probably not a good choice
191-
for production environments.
186+
各サーバプロセスは、個別にキャッシュインスタンスを保持するので、プロセス間
187+
でキャッシュは共有されません。このことから、明らかに、ローカルメモリキャッ
188+
シュのメモリ効率は非常に悪いといえます。おそらく実運用環境向きとではないで
189+
しょう。
192190

193191
.. _Dummy caching (for development):
194192

@@ -207,26 +205,26 @@ for production environments.
207205

208206
CACHE_BACKEND = 'dummy:///'
209207

210-
Using a custom cache backend
211-
----------------------------
208+
カスタムのキャッシュバックエンドを使う
209+
-----------------------------------------
212210

213211
.. versionadded:: 1.0
214212

215-
While Django includes support for a number of cache backends out-of-the-box,
216-
sometimes you will want to use a customised version or your own backend. To
217-
use an external cache backend with Django, use a Python import path as the
218-
scheme portion (the part before the initial colon) of the
219-
:setting:`CACHE_BACKEND` URI, like so::
213+
Django には、すぐに使えるキャッシュバックエンドがいくつもありますが、カスタ
214+
マイズしたバックエンドや自作のバックエンドを使いたい場合もあるでしょう。
215+
外部のキャッシュバックエンドを Django と組み合わせたいなら、以下のように、
216+
Python import パスを :setting:`CACHE_BACKEND` URI のスキーム部分 (最
217+
初のコロンより前の部分) に指定します::
220218

221219
CACHE_BACKEND = 'path.to.backend://'
222220

223-
If you're building your own backend, you can use the standard cache backends
224-
as reference implementations. You'll find the code in the
225-
:file:`django/core/cache/backends/` directory of the Django source.
221+
自作のバックエンドを作成しているなら、リファレンス実装として標準のキャッシュ
222+
バックエンドを使うとよいでしょう。キャッシュバックエンドは Django のソース
223+
中の :file:`django/core/cache/backends/` ディレクトリ下にあります。
226224

227-
Note: Without a really compelling reason, like a host that doesn't support the
228-
them, you should stick to the cache backends included with Django. They've
229-
been really well-tested and are quite easy to use.
225+
注意: 運用ホスト上でサポートされていないなど、本当に特別な理由がないかぎり、
226+
Django 組み込みのキャッシュバックエンドを使った方がよいでしょう。組み込みの
227+
バックエンドは良くテストされており、とても簡単に扱えます。
230228

231229
.. _CACHE_BACKEND arguments:
232230

@@ -287,12 +285,12 @@ In this example, ``timeout`` is ``30`` and ``max_entries`` is ``400``::
287285
'django.middleware.cache.FetchFromCacheMiddleware',
288286
)
289287

290-
.. TBD
291288
.. note::
292289

293-
No, that's not a typo: the "update" middleware must be first in the list,
294-
and the "fetch" middleware must be last. The details are a bit obscure, but
295-
see `Order of MIDDLEWARE_CLASSES`_ below if you'd like the full story.
290+
そう、ミドルウェアの順番は、これで間違っていません。 "Update" ミドルウェ
291+
アがリストの先頭で、 "Fetch" ミドルウェアが末尾です。詳しいからくりは
292+
ちょっとややこしいのですが、後述の `MIDDLEWARE_CLASSES の順番`_ で説明
293+
しています。
296294

297295
次に,以下の必須の設定を Django 設定ファイルに追加します:
298296

@@ -463,11 +461,9 @@ get() には ``default`` 引数を指定できます::
463461
>>> cache.get('add_key')
464462
'Initial value'
465463

466-
.. TBD
467-
468-
If you need to know whether ``add()`` stored a value in the cache, you can
469-
check the return value. It will return ``True`` if the value was stored,
470-
``False`` otherwise.
464+
``add()`` によってキャッシュにデータが保存されたどうかを知りたければ、戻り
465+
値をチェックしてください。戻り値が ``True`` なら、保存されています。そうで
466+
ないときは ``False`` を返します。
471467

472468
キャッシュを一度しかアクセスしない ``get_many()`` インタフェースもあります.
473469
``get_many()`` は指定した全てのキーのうち,キャッシュ内に実在する (そして期
@@ -719,28 +715,26 @@ Django には,アプリケーションのパフォーマンスを最適化す
719715
MIDDLEWARE_CLASSES の順番
720716
=========================
721717

722-
.. TBD
718+
キャッシュ関連のミドルウェアを使う場合、 ``MIDDLEWARE_CLASSES`` 設定中の
719+
正しい場所に配置することが重要です。というのも、キャッシュミドルウェアは
720+
キャッシュストレージ上のコンテンツとの差異を検出するために、どのヘッダが変
721+
更されたかを調べる必要があるからです。ミドルウェアは通常、必要に応じて
722+
``Vary`` レスポンスヘッダに情報を付加します。
723723

724-
If you use caching middleware, it's important to put each half in the right
725-
place within the ``MIDDLEWARE_CLASSES`` setting. That's because the cache
726-
middleware needs to know which headers by which to vary the cache storage.
727-
Middleware always adds something to the ``Vary`` response header when it can.
728-
729-
``UpdateCacheMiddleware`` runs during the response phase, where middleware is
730-
run in reverse order, so an item at the top of the list runs *last* during the
731-
response phase. Thus, you need to make sure that ``UpdateCacheMiddleware``
732-
appears *before* any other middleware that might add something to the ``Vary``
733-
header. The following middleware modules do so:
724+
``UpdateCacheMiddleware`` はレスポンスフェイズに動作します。レスポンスフェ
725+
イズのミドルウェアは逆順に処理されるので、リストの先頭のミドルウェアは
726+
*最後* に呼び出されます。従って、 ``UpdateCacheMiddleware`` は、 ``Vary``
727+
ヘッダに何らかの情報を付加するミドルウェアよりも *手前* に追加せねばなりま
728+
せん。以下のミドルウェアが、 ``Vary`` ヘッダを操作します:
734729

735730
* ``SessionMiddleware`` ``Cookie`` を追加します.
736731
* ``GZipMiddleware`` ``Accept-Encoding`` を追加します.
737732
* ``LocaleMiddleware`` ``Accept-Language`` を追加します.
738733

739-
.. TBD
740-
741-
``FetchFromCacheMiddleware``, on the other hand, runs during the request phase,
742-
where middleware is applied first-to-last, so an item at the top of the list
743-
runs *first* during the request phase. The ``FetchFromCacheMiddleware`` also
744-
needs to run after other middleware updates the ``Vary`` header, so
745-
``FetchFromCacheMiddleware`` must be *after* any item that does so.
734+
一方、 ``FetchFromCacheMiddleware`` はリクエストフェイズに動作します。リク
735+
エストフェイズでは、ミドルウェアは先頭から末尾に向けて処理されるので、
736+
リストの先頭にあるミドルウェアが *最初* に呼び出されます。
737+
``FetchFromCacheMiddleware`` もまた、 ``Vary`` ヘッダを操作するミドルウェア
738+
よりも後に呼び出さねばならないので、 ``FetchFromCacheMiddleware``
739+
*後ろ* に置かねばなりません。
746740

0 commit comments

Comments
 (0)