55#
66# Translators:
77# tomo, 2022
8+ # righteous righteous, 2023
89#
910#, fuzzy
1011msgid ""
1112msgstr ""
1213"Project-Id-Version : Python 3.12\n "
1314"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2023-09-15 14:13 +0000\n "
15+ "POT-Creation-Date : 2023-09-29 14:12 +0000\n "
1516"PO-Revision-Date : 2021-06-28 00:54+0000\n "
16- "Last-Translator : tomo, 2022 \n "
17+ "Last-Translator : righteous righteous, 2023 \n "
1718"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
1819"ja/)\n "
1920"MIME-Version : 1.0\n "
@@ -31,16 +32,20 @@ msgid ""
3132"In Python, the special name ``__main__`` is used for two important "
3233"constructs:"
3334msgstr ""
35+ "Python では、 ``__main__`` という特別な名前が次の二つの重要な用途で使われま"
36+ "す:"
3437
3538#: ../../library/__main__.rst:12
3639msgid ""
3740"the name of the top-level environment of the program, which can be checked "
3841"using the ``__name__ == '__main__'`` expression; and"
3942msgstr ""
43+ "プログラムのトップレベル環境の名前。\n"
44+ "``__name__ == '__main__'`` という式でチェックすることができる。"
4045
4146#: ../../library/__main__.rst:14
4247msgid "the ``__main__.py`` file in Python packages."
43- msgstr ""
48+ msgstr "Python パッケージにおける ``__main__.py`` ファイル。 "
4449
4550#: ../../library/__main__.rst:16
4651msgid ""
@@ -49,6 +54,12 @@ msgid ""
4954"detail below. If you're new to Python modules, see the tutorial section :"
5055"ref:`tut-modules` for an introduction."
5156msgstr ""
57+ "どちらも Python のモジュールに関わる機能です。\n"
58+ "1つ目はユーザーがどうモジュールを使うか、2つ目はモジュールとモジュールがど"
59+ "うやりとりするかに関係します。\n"
60+ "詳細は以下で説明します。\n"
61+ "Python モジュールがどういうものかについては、 :ref:`tut-modules` を参照してく"
62+ "ださい。"
5263
5364#: ../../library/__main__.rst:25
5465msgid "``__name__ == '__main__'``"
@@ -60,22 +71,30 @@ msgid ""
6071"module's name. Usually, this is the name of the Python file itself without "
6172"the ``.py`` extension::"
6273msgstr ""
74+ "Python モジュールやパッケージがインポートされるとき、 ``__name__`` の値はその"
75+ "モジュールの名前となります。\n"
76+ "通常、インポートされる Python ファイル自体のファイル名から拡張子``.py`` を除"
77+ "いたものとなります::"
6378
6479#: ../../library/__main__.rst:35
6580msgid ""
6681"If the file is part of a package, ``__name__`` will also include the parent "
6782"package's path::"
6883msgstr ""
84+ "インポートされるファイルがパッケージの一部である場合は、 ``__name__`` にはそ"
85+ "のパッケージのパスも含まれます::"
6986
7087#: ../../library/__main__.rst:42
7188msgid ""
7289"However, if the module is executed in the top-level code environment, its "
7390"``__name__`` is set to the string ``'__main__'``."
7491msgstr ""
92+ "しかし、モジュールがトップレベルのスクリプト環境で実行される場合は、 "
93+ "``__name__`` が ``'__main__'`` という文字列になります。"
7594
7695#: ../../library/__main__.rst:46
7796msgid "What is the \" top-level code environment\" ?"
78- msgstr ""
97+ msgstr "「トップレベルのスクリプト環境」とは "
7998
8099#: ../../library/__main__.rst:48
81100msgid ""
@@ -88,36 +107,41 @@ msgstr ""
88107
89108#: ../../library/__main__.rst:53
90109msgid "The top-level code environment can be:"
91- msgstr ""
110+ msgstr "以下のものがトップレベルのスクリプト環境となります: "
92111
93112#: ../../library/__main__.rst:55
94113msgid "the scope of an interactive prompt::"
95- msgstr ""
114+ msgstr "インタラクティブプロンプトのスコープ:: "
96115
97116#: ../../library/__main__.rst:60
98117msgid "the Python module passed to the Python interpreter as a file argument:"
99- msgstr ""
118+ msgstr "Python インタープリタにファイル引数として渡される Python モジュール: "
100119
101120#: ../../library/__main__.rst:67
102121msgid ""
103122"the Python module or package passed to the Python interpreter with the :"
104123"option:`-m` argument:"
105124msgstr ""
125+ "Python インタープリタにPython :option:`-m` オプションとして渡される Python モ"
126+ "ジュールまたはパッケージ:"
106127
107128#: ../../library/__main__.rst:75
108129msgid "Python code read by the Python interpreter from standard input:"
109- msgstr ""
130+ msgstr "標準入力から Python インタープリタが読み込む Python コード: "
110131
111132#: ../../library/__main__.rst:86
112133msgid ""
113134"Python code passed to the Python interpreter with the :option:`-c` argument:"
114135msgstr ""
136+ "Python インタープリタに :option:`-c` オプションで渡される Python コード:"
115137
116138#: ../../library/__main__.rst:97
117139msgid ""
118140"In each of these situations, the top-level module's ``__name__`` is set to "
119141"``'__main__'``."
120142msgstr ""
143+ "上記それぞれの場合で、トップレベルのモジュールの ``__name__`` の値が "
144+ "``'__main__'`` となります。"
121145
122146#: ../../library/__main__.rst:100
123147msgid ""
@@ -126,16 +150,22 @@ msgid ""
126150"idiom for conditionally executing code when the module is not initialized "
127151"from an import statement::"
128152msgstr ""
153+ "これにより、 ``__name__`` をチェックすれば各モジュールは自分がトップレベル環"
154+ "境で実行されているかどうかを知ることができます。\n"
155+ "このことから、モジュールが import 文で初期化された場合以外の場合でのみコード"
156+ "を実行するため、次のコードがしばしば用いられます::"
129157
130158#: ../../library/__main__.rst:111
131159msgid ""
132160"For a more detailed look at how ``__name__`` is set in all situations, see "
133161"the tutorial section :ref:`tut-modules`."
134162msgstr ""
163+ "あらゆる場合に ``__name__`` の値がどうセットされるのかについて、詳しくは"
164+ "チュートリアルの :ref:`tut-modules` セクションを参照してください。"
135165
136166#: ../../library/__main__.rst:116 ../../library/__main__.rst:239
137167msgid "Idiomatic Usage"
138- msgstr ""
168+ msgstr "通常の使われ方 "
139169
140170#: ../../library/__main__.rst:118
141171msgid ""
@@ -144,20 +174,31 @@ msgid ""
144174"like this was imported from a different module, for example to unit test it, "
145175"the script code would unintentionally execute as well."
146176msgstr ""
177+ "一部のモジュールでは、コマンドライン引数をパースしたり標準入力からデータを取"
178+ "得したなど、スクリプト用途のみのコードが含まれています。\n"
179+ "このようなモジュールが、例えばユニットテストのため、別のモジュールからイン"
180+ "ポートされると、そのスクリプト用コードが意図に反して実行されてしまいます。"
147181
148182#: ../../library/__main__.rst:123
149183msgid ""
150184"This is where using the ``if __name__ == '__main__'`` code block comes in "
151185"handy. Code within this block won't run unless the module is executed in the "
152186"top-level environment."
153187msgstr ""
188+ "``if __name__ == '__main__'`` というコードは、このようなときに役立ちます。\n"
189+ "このブロックの中にあるコードは、当該のモジュールがトップレベル環境で実行され"
190+ "ていない限り、実行されません。"
154191
155192#: ../../library/__main__.rst:127
156193msgid ""
157194"Putting as few statements as possible in the block below ``if __name__ == "
158195"'__main__'`` can improve code clarity and correctness. Most often, a "
159196"function named ``main`` encapsulates the program's primary behavior::"
160197msgstr ""
198+ "``if __name__ == '__main__'`` の下のブロックにあるコードはできるだけ少なくし"
199+ "た方が、コードの分かりやすさや正確さにつながります。\n"
200+ "最もよくあるのが、プログラムの主要な処理を ``main`` 関数の中にカプセル化する"
201+ "ことです::"
161202
162203#: ../../library/__main__.rst:151
163204msgid ""
@@ -168,6 +209,12 @@ msgid ""
168209"the global variable instead of a local name. A ``main`` function solves "
169210"this problem."
170211msgstr ""
212+ "注意すべき点として、もし ``main`` 関数内のコードをカプセル化せず ``if "
213+ "__name__ == '__main__'`` の下に直接書いた場合、 ``phrase`` 変数はモジュール全"
214+ "体からグローバルにアクセスできてしまいます。\n"
215+ "モジュール内の他の関数が意図せずローカル変数ではなくそのグローバル変数を使用"
216+ "してしまう可能性があるため、ミスにつながります。\n"
217+ "``main`` 関数を用意することでこの問題は解決できます。"
171218
172219#: ../../library/__main__.rst:158
173220msgid ""
@@ -176,6 +223,11 @@ msgid ""
176223"imported, the ``echo`` and ``main`` functions will be defined, but neither "
177224"of them will be called, because ``__name__ != '__main__'``."
178225msgstr ""
226+ "``main`` 関数を使うことのもう一つのメリットとして、 ``echo`` 関数が分離し、別"
227+ "の場所からインポートできるようになることです。\n"
228+ "``echo.py`` がインポートされるとき、 ``echo`` 関数と ``main`` 関数が定義され"
229+ "ますが、 ``__name__ != '__main__'`` であるため、どちらの関数も呼び出されませ"
230+ "ん。"
179231
180232#: ../../library/__main__.rst:165
181233msgid "Packaging Considerations"
0 commit comments