Skip to content

Commit e0af80a

Browse files
committed
模組與組態設定條目新增翻譯
1 parent ed7031f commit e0af80a

3 files changed

Lines changed: 20 additions & 27 deletions

File tree

source/general/configuration.rst

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ CodeIgniter 希望你將 **.env** 檔案置於根目錄下,緊鄰 ``system``
170170
用環境變數替代資料
171171
==============================================
172172

173-
請牢記在 **env** 中包含的環境變數 **只會替換現有資料** ,這非常重要。這表示你不能在你的 **.env** 設定任何在相關配置文件中沒有宣告的內容
173+
請牢記在 **env** 中包含的環境變數 **只會替換現有資料** ,這非常重要。這表示你不能在你的 **.env** 設定任何在相關組態設定檔案中沒有宣告的內容
174174

175-
**.env** 的作用僅是填充或替換你的組態設定檔案中的數值。也就是說,你的組態設定文件應該要有一個容器或用於接收數值的屬性。在你的 **.env** 中加入很多變數,但卻沒有任何東西可以接收這些變數的內容,這並不是個好作法。
175+
**.env** 的作用僅是填充或替換你的組態設定檔案中的數值。也就是說,你的組態設定檔案應該要有一個容器或用於接收數值的屬性。在你的 **.env** 中加入很多變數,但卻沒有任何東西可以接收這些變數的內容,這並不是個好作法。
176176

177177
簡單地說,你不能只是將 ``app.myNewConfig = foo`` 放在你的 **.env** 中,並且希望 ``Config\App`` 在執行時期能夠像是施魔法一般出現這個屬性以及數值。
178178

@@ -224,21 +224,16 @@ CodeIgniter 希望你將 **.env** 檔案置於根目錄下,緊鄰 ``system``
224224
註冊器
225225
==========
226226

227-
"Registrars" are any other classes which might provide additional configuration properties.
228-
Registrars provide a means of altering a configuration at runtime across namespaces and files.
229-
There are two ways to implement a Registrar: implicit and explicit.
227+
註冊器 ``Registrars`` 是任何可能提供額外組態屬性的類別,註冊器提供一種在執行時期時命名空間與檔案改變組態的方法。有顯性與隱性兩種方法用於實作出註冊器。
230228

231-
.. note:: Values from **.env** always take priority over Registrars.
229+
.. note:: 來自 ``.env`` 中的數值將始終優先於註冊器。
232230

233231
隱性註冊器
234232
-------------------
235233

236-
Any namespace may define registrars by using the **Config/Registrar.php** file, if discovery
237-
is enabled in :doc:`Modules </general/modules>`. These files are classes whose methods are
238-
named for each configuration class you wish to extend. For example, a third-party module might
239-
wish to supply an additional template to ``Pager`` without overwriting whatever a develop has
240-
already configured. In **src/Config/Registrar.php** there would be a ``Registrar`` class with
241-
the single ``Pager()`` method (note the case-sensitivity)::
234+
如果在 :doc:`程式碼模組 </general/modules>` 中啟用了自動探索,任何命名空間都可以透過使用 **Config/Registrar.php** 檔案來宣告註冊器。這些檔案是一些類別,類別中的方法命名以需要擴充的組態設定類別為準。例如:第三方模組可能希望 ``Pager`` 提供額外的樣板,而不覆蓋開發人員已經設定好的任何內容。在 **src/Config/Registrar.php** 中,將有一個具有 ``Pager()`` 方法的 ``Registrar`` 類別(請注意大小寫敏感)。
235+
236+
::
242237

243238
class Registrar
244239
{
@@ -252,9 +247,8 @@ the single ``Pager()`` method (note the case-sensitivity)::
252247
}
253248
}
254249

255-
Registrar methods must always return an array, with keys corresponding to the properties
256-
of the target config file. Existing values are merged, and Registrar properties have
257-
overwrite priority.
250+
註冊器方法必須總是回傳鍵值陣列,它的鍵呼應目標組態設定檔案的屬性。合併現有的數值,並且註冊器屬性在覆蓋上具備優先級。
251+
258252

259253
顯性註冊器
260254
-------------------

source/general/modules.rst

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,9 @@ CodeIgniter 支援使用程式碼模組化的方式,幫助你創建具有重
6161
自動載入無類別檔案
6262
===========================
6363

64-
More often than not that your module will not contain only PHP classes but also others like procedural
65-
functions, bootstrapping files, module constants files, etc. which are not normally loaded the way classes
66-
are loaded. One approach for this is using ``require``-ing the file(s) at the start of the file where it
67-
would be used.
64+
通常來說,你的模組可能不只有 PHP 類別,還會包含:程序式函數、引導檔案,模組常數檔案等。這些檔案通常不會以類別的方式被載入,這時可能會使用 ``require`` 的方式載入會使用到的檔案。
6865

69-
Another approach provided by CodeIgniter is to autoload these *non-class* files like how you would autoload
70-
your classes. All we need to do is provide the list of paths to those files and include them in the
71-
``$files`` property of your **app/Config/Autoload.php** file.
66+
而 CodeIgniter 提供你一種自動載入這些非類別檔案的方式,就像是類別自動載入一樣。我們需要提供這些檔案的路徑清單,並將它們宣告在 **app/Config/Autoload.php** 中的 ``$files`` 屬性。
7267

7368
::
7469

@@ -133,13 +128,13 @@ Composer 與探索
133128
過濾器
134129
=======
135130

136-
By default, :doc:`filters </incoming/filters>` are automatically scanned for within modules.
137-
It can be turned off in the **Modules** config file, described above.
131+
預設的情況下,會自動掃描模組內的 :doc:`過濾器 </incoming/filters>` 。它可以在 **Modules** 的設定檔案中被關閉。
138132

139-
.. note:: Since the files are being included into the current scope, the ``$filters`` instance is already defined for you.
140-
It will cause errors if you attempt to redefine that class.
133+
.. note:: 由於檔案包含在目前的作用域中,因此已經為你宣告好了 ``$filters`` 實體。如果你試圖重新宣告這個類別,則會導致錯誤。
141134

142-
In the module's **Config/Filters.php** file, you need to define the aliases of the filters you use.::
135+
在模組的 **Config/Filters.php** 檔案中,你需要宣告你使用的過濾器別名。
136+
137+
::
143138

144139
$filters->aliases['menus'] = MenusFilter::class;
145140

source/translation/glossary.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@
181181
+-----------------------+----------------------+
182182
| shared | 共用 |
183183
+-----------------------+----------------------+
184+
| procedural | 程序式 |
185+
+-----------------------+----------------------+
186+
| constants | 常數 |
187+
+-----------------------+----------------------+
184188

185189
手冊相關
186190
--------

0 commit comments

Comments
 (0)