5
5
#
6
6
# Translators:
7
7
# tomo, 2022
8
+ # righteous righteous, 2023
8
9
#
9
10
#, fuzzy
10
11
msgid ""
11
12
msgstr ""
12
13
"Project-Id-Version : Python 3.12\n "
13
14
"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 "
15
16
"PO-Revision-Date : 2021-06-28 00:54+0000\n "
16
- "Last-Translator : tomo, 2022 \n "
17
+ "Last-Translator : righteous righteous, 2023 \n "
17
18
"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
18
19
"ja/)\n "
19
20
"MIME-Version : 1.0\n "
@@ -31,16 +32,20 @@ msgid ""
31
32
"In Python, the special name ``__main__`` is used for two important "
32
33
"constructs:"
33
34
msgstr ""
35
+ "Python では、 ``__main__`` という特別な名前が次の二つの重要な用途で使われま"
36
+ "す:"
34
37
35
38
#: ../../library/__main__.rst:12
36
39
msgid ""
37
40
"the name of the top-level environment of the program, which can be checked "
38
41
"using the ``__name__ == '__main__'`` expression; and"
39
42
msgstr ""
43
+ "プログラムのトップレベル環境の名前。\n"
44
+ "``__name__ == '__main__'`` という式でチェックすることができる。"
40
45
41
46
#: ../../library/__main__.rst:14
42
47
msgid "the ``__main__.py`` file in Python packages."
43
- msgstr ""
48
+ msgstr "Python パッケージにおける ``__main__.py`` ファイル。 "
44
49
45
50
#: ../../library/__main__.rst:16
46
51
msgid ""
@@ -49,6 +54,12 @@ msgid ""
49
54
"detail below. If you're new to Python modules, see the tutorial section :"
50
55
"ref:`tut-modules` for an introduction."
51
56
msgstr ""
57
+ "どちらも Python のモジュールに関わる機能です。\n"
58
+ "1つ目はユーザーがどうモジュールを使うか、2つ目はモジュールとモジュールがど"
59
+ "うやりとりするかに関係します。\n"
60
+ "詳細は以下で説明します。\n"
61
+ "Python モジュールがどういうものかについては、 :ref:`tut-modules` を参照してく"
62
+ "ださい。"
52
63
53
64
#: ../../library/__main__.rst:25
54
65
msgid "``__name__ == '__main__'``"
@@ -60,22 +71,30 @@ msgid ""
60
71
"module's name. Usually, this is the name of the Python file itself without "
61
72
"the ``.py`` extension::"
62
73
msgstr ""
74
+ "Python モジュールやパッケージがインポートされるとき、 ``__name__`` の値はその"
75
+ "モジュールの名前となります。\n"
76
+ "通常、インポートされる Python ファイル自体のファイル名から拡張子``.py`` を除"
77
+ "いたものとなります::"
63
78
64
79
#: ../../library/__main__.rst:35
65
80
msgid ""
66
81
"If the file is part of a package, ``__name__`` will also include the parent "
67
82
"package's path::"
68
83
msgstr ""
84
+ "インポートされるファイルがパッケージの一部である場合は、 ``__name__`` にはそ"
85
+ "のパッケージのパスも含まれます::"
69
86
70
87
#: ../../library/__main__.rst:42
71
88
msgid ""
72
89
"However, if the module is executed in the top-level code environment, its "
73
90
"``__name__`` is set to the string ``'__main__'``."
74
91
msgstr ""
92
+ "しかし、モジュールがトップレベルのスクリプト環境で実行される場合は、 "
93
+ "``__name__`` が ``'__main__'`` という文字列になります。"
75
94
76
95
#: ../../library/__main__.rst:46
77
96
msgid "What is the \" top-level code environment\" ?"
78
- msgstr ""
97
+ msgstr "「トップレベルのスクリプト環境」とは "
79
98
80
99
#: ../../library/__main__.rst:48
81
100
msgid ""
@@ -88,36 +107,41 @@ msgstr ""
88
107
89
108
#: ../../library/__main__.rst:53
90
109
msgid "The top-level code environment can be:"
91
- msgstr ""
110
+ msgstr "以下のものがトップレベルのスクリプト環境となります: "
92
111
93
112
#: ../../library/__main__.rst:55
94
113
msgid "the scope of an interactive prompt::"
95
- msgstr ""
114
+ msgstr "インタラクティブプロンプトのスコープ:: "
96
115
97
116
#: ../../library/__main__.rst:60
98
117
msgid "the Python module passed to the Python interpreter as a file argument:"
99
- msgstr ""
118
+ msgstr "Python インタープリタにファイル引数として渡される Python モジュール: "
100
119
101
120
#: ../../library/__main__.rst:67
102
121
msgid ""
103
122
"the Python module or package passed to the Python interpreter with the :"
104
123
"option:`-m` argument:"
105
124
msgstr ""
125
+ "Python インタープリタにPython :option:`-m` オプションとして渡される Python モ"
126
+ "ジュールまたはパッケージ:"
106
127
107
128
#: ../../library/__main__.rst:75
108
129
msgid "Python code read by the Python interpreter from standard input:"
109
- msgstr ""
130
+ msgstr "標準入力から Python インタープリタが読み込む Python コード: "
110
131
111
132
#: ../../library/__main__.rst:86
112
133
msgid ""
113
134
"Python code passed to the Python interpreter with the :option:`-c` argument:"
114
135
msgstr ""
136
+ "Python インタープリタに :option:`-c` オプションで渡される Python コード:"
115
137
116
138
#: ../../library/__main__.rst:97
117
139
msgid ""
118
140
"In each of these situations, the top-level module's ``__name__`` is set to "
119
141
"``'__main__'``."
120
142
msgstr ""
143
+ "上記それぞれの場合で、トップレベルのモジュールの ``__name__`` の値が "
144
+ "``'__main__'`` となります。"
121
145
122
146
#: ../../library/__main__.rst:100
123
147
msgid ""
@@ -126,16 +150,22 @@ msgid ""
126
150
"idiom for conditionally executing code when the module is not initialized "
127
151
"from an import statement::"
128
152
msgstr ""
153
+ "これにより、 ``__name__`` をチェックすれば各モジュールは自分がトップレベル環"
154
+ "境で実行されているかどうかを知ることができます。\n"
155
+ "このことから、モジュールが import 文で初期化された場合以外の場合でのみコード"
156
+ "を実行するため、次のコードがしばしば用いられます::"
129
157
130
158
#: ../../library/__main__.rst:111
131
159
msgid ""
132
160
"For a more detailed look at how ``__name__`` is set in all situations, see "
133
161
"the tutorial section :ref:`tut-modules`."
134
162
msgstr ""
163
+ "あらゆる場合に ``__name__`` の値がどうセットされるのかについて、詳しくは"
164
+ "チュートリアルの :ref:`tut-modules` セクションを参照してください。"
135
165
136
166
#: ../../library/__main__.rst:116 ../../library/__main__.rst:239
137
167
msgid "Idiomatic Usage"
138
- msgstr ""
168
+ msgstr "通常の使われ方 "
139
169
140
170
#: ../../library/__main__.rst:118
141
171
msgid ""
@@ -144,20 +174,31 @@ msgid ""
144
174
"like this was imported from a different module, for example to unit test it, "
145
175
"the script code would unintentionally execute as well."
146
176
msgstr ""
177
+ "一部のモジュールでは、コマンドライン引数をパースしたり標準入力からデータを取"
178
+ "得したなど、スクリプト用途のみのコードが含まれています。\n"
179
+ "このようなモジュールが、例えばユニットテストのため、別のモジュールからイン"
180
+ "ポートされると、そのスクリプト用コードが意図に反して実行されてしまいます。"
147
181
148
182
#: ../../library/__main__.rst:123
149
183
msgid ""
150
184
"This is where using the ``if __name__ == '__main__'`` code block comes in "
151
185
"handy. Code within this block won't run unless the module is executed in the "
152
186
"top-level environment."
153
187
msgstr ""
188
+ "``if __name__ == '__main__'`` というコードは、このようなときに役立ちます。\n"
189
+ "このブロックの中にあるコードは、当該のモジュールがトップレベル環境で実行され"
190
+ "ていない限り、実行されません。"
154
191
155
192
#: ../../library/__main__.rst:127
156
193
msgid ""
157
194
"Putting as few statements as possible in the block below ``if __name__ == "
158
195
"'__main__'`` can improve code clarity and correctness. Most often, a "
159
196
"function named ``main`` encapsulates the program's primary behavior::"
160
197
msgstr ""
198
+ "``if __name__ == '__main__'`` の下のブロックにあるコードはできるだけ少なくし"
199
+ "た方が、コードの分かりやすさや正確さにつながります。\n"
200
+ "最もよくあるのが、プログラムの主要な処理を ``main`` 関数の中にカプセル化する"
201
+ "ことです::"
161
202
162
203
#: ../../library/__main__.rst:151
163
204
msgid ""
@@ -168,6 +209,12 @@ msgid ""
168
209
"the global variable instead of a local name. A ``main`` function solves "
169
210
"this problem."
170
211
msgstr ""
212
+ "注意すべき点として、もし ``main`` 関数内のコードをカプセル化せず ``if "
213
+ "__name__ == '__main__'`` の下に直接書いた場合、 ``phrase`` 変数はモジュール全"
214
+ "体からグローバルにアクセスできてしまいます。\n"
215
+ "モジュール内の他の関数が意図せずローカル変数ではなくそのグローバル変数を使用"
216
+ "してしまう可能性があるため、ミスにつながります。\n"
217
+ "``main`` 関数を用意することでこの問題は解決できます。"
171
218
172
219
#: ../../library/__main__.rst:158
173
220
msgid ""
@@ -176,6 +223,11 @@ msgid ""
176
223
"imported, the ``echo`` and ``main`` functions will be defined, but neither "
177
224
"of them will be called, because ``__name__ != '__main__'``."
178
225
msgstr ""
226
+ "``main`` 関数を使うことのもう一つのメリットとして、 ``echo`` 関数が分離し、別"
227
+ "の場所からインポートできるようになることです。\n"
228
+ "``echo.py`` がインポートされるとき、 ``echo`` 関数と ``main`` 関数が定義され"
229
+ "ますが、 ``__name__ != '__main__'`` であるため、どちらの関数も呼び出されませ"
230
+ "ん。"
179
231
180
232
#: ../../library/__main__.rst:165
181
233
msgid "Packaging Considerations"
0 commit comments