Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ja/console-and-shells/cron-jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cron ジョブに登録してシェルを実行する
通常シェルは、ニュースレターを送ったり、たまにデータベースをクリーンアップしたりすることを、
cron ジョブとして実行します。

このように簡単な設定で行えます。::
このように簡単な設定で行えます。 ::

*/5 * * * * cd /full/path/to/app && bin/cake myshell myparam
# * * * * * 実行するコマンド
Expand Down Expand Up @@ -33,9 +33,9 @@ cron ジョブとして実行します。
.. note::
php.ini の中で ``register_argc_argv = 1`` を含めることによって、
register_argc_argv を有効にしなければなりません。グローバルに register_argc_argv
を変更できない場合、 ``-c /full/path/to/root/php.ini`` をつけることで
cron ジョブに独自の設定ファイル (php.ini) を指定することができます。例: ``php -c
/full/path/to/root/php.ini /full/path/to/root/bin/cake.php myshell
を変更できない場合、 ``-d register_argc_argv=1`` パラメーターをつけることで
cron ジョブに独自の設定ファイル (php.ini) を指定することができます。例: ``php
-d register_argc_argv=1 /full/path/to/root/bin/cake.php myshell
myparam``

.. meta::
Expand Down
33 changes: 11 additions & 22 deletions ja/core-libraries/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,19 @@
メソッド一覧
=============

.. table::
.. csv-table::
:class: docutils internal-toc

+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`append` | :php:meth:`buffered` | :php:meth:`combine` | :php:meth:`compile` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`contains` | :php:meth:`countBy` | :php:meth:`chunk` | :php:meth:`each` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`every` | :php:meth:`extract` | :php:meth:`filter` | :php:meth:`first` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`groupBy` | :php:meth:`indexBy` | :php:meth:`insert` | :php:meth:`isEmpty` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`last` | :php:meth:`listNested` | :php:meth:`map` | :php:meth:`match` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`max` | :php:meth:`min` | :php:meth:`nest` | :php:meth:`reduce` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`reject` | :php:meth:`sample` | :php:meth:`shuffle` | :php:meth:`skip` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`some` | :php:meth:`sortBy` | :php:meth:`stopWhen` | :php:meth:`sumOf` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`take` | :php:meth:`through` | :php:meth:`unfold` | :php:meth:`zip` |
+-----------------------+---------------------------+----------------------+---------------------+
| :php:meth:`transpose` | :php:meth:`chunkWithKeys` | | |
+-----------------------+---------------------------+----------------------+---------------------+
:php:meth:`append`, :php:meth:`buffered`, :php:meth:`chunk`, :php:meth:`chunkWithKeys`
:php:meth:`combine`, :php:meth:`compile`, :php:meth:`contains`, :php:meth:`countBy`,
:php:meth:`each`, :php:meth:`every`, :php:meth:`extract`, :php:meth:`filter`
:php:meth:`first`, :php:meth:`groupBy`, :php:meth:`indexBy`, :php:meth:`insert`
:php:meth:`isEmpty`, :php:meth:`last`, :php:meth:`listNested`, :php:meth:`map`
:php:meth:`match`, :php:meth:`max`, :php:meth:`min`, :php:meth:`nest`
:php:meth:`reduce`, :php:meth:`reject`, :php:meth:`sample`, :php:meth:`shuffle`
:php:meth:`skip`, :php:meth:`some`, :php:meth:`sortBy`, :php:meth:`stopWhen`
:php:meth:`sumOf`, :php:meth:`take`, :php:meth:`through`, :php:meth:`transpose`
:php:meth:`unfold`, :php:meth:`zip`

反復
====
Expand Down
13 changes: 13 additions & 0 deletions ja/core-libraries/httpclient.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,19 @@ Client インスタンスに格納されているクッキーは、それ以後
'cookies' => ['sessionid' => '123abc']
]);

``addCookie()`` メソッドを使って、作成された後のクライアントにクッキーオブジェクトを
追加することができます。 ::

use Cake\Http\Cookie\Cookie;

$http = new Client([
'host' => 'cakephp.org'
]);
$http->addCookie(new Cookie('session', 'abc123'));

.. versionadded:: 3.5.0
``addCookie()`` は 3.5.0 で追加されました。

.. _httpclient-response-objects:

レスポンスオブジェクト
Expand Down
9 changes: 6 additions & 3 deletions ja/core-libraries/internationalization-and-localization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ i18n シェルを利用できます。より知りたい場合は、 :doc:`次
デフォルトの翻訳言語、日付のフォーマット、番号のフォーマットおよび通貨を含む、
アプリケーションのいくつかの様相をコントロールします。

ランタイムでロケールを変更する
実行時にロケールを変更する
------------------------------

翻訳文字列の言語を変更する場合はこのメソッドを呼び出せます。 ::

use Cake\I18n\I18n;

// 3.5 より前は I18n::locale() を使用します
I18n::setLocale('de_DE');

地域化のツールを使うと、これは数字や日付がどのようにフォーマットされているかについても変更します。
Expand Down Expand Up @@ -361,7 +362,7 @@ Gettext の複数形選択を使用する

use Aura\Intl\Package;

I18n::translator('animals', function () {
I18n::setTranslator('animals', function () {
$package = new Package(
'default', // フォーマット戦略 (ICU)
'default' // フォールバックドメイン
Expand All @@ -380,6 +381,7 @@ Gettext の複数形選択を使用する
見つかります。翻訳機構を作成するのに最低限必要なのは、ローダー機能が ``Aura\Intl\Package``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 365:

I18n::translator('animals', function () {

Seems to be still outdated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I updated.

オブジェクトを返すことです。一旦コードを置けば、翻訳機能は以下のように利用できるでしょう。 ::

// 3.5 より前は I18n::locale() を使用します
I18n::setLocale('fr_FR');
__d('animals', 'Dog'); // "Chien" を返す

Expand All @@ -392,7 +394,7 @@ Gettext の複数形選択を使用する
use Cake\I18n\MessagesFileLoader as Loader;

// src/Locale/folder/sub_folder/filename.po からメッセージをロード

// 3.5 より前は translator() を使用します
I18n::setTranslator(
'animals',
new Loader('filename', 'folder/sub_folder', 'po'),
Expand Down Expand Up @@ -432,6 +434,7 @@ CakePHP が利用しているものと同じやり方を使い続けることも

use Cake\I18n\MessagesFileLoader as Loader;

// 3.5 より前は translator() を使用します
I18n::setTranslator(
'animals',
new Loader('animals', 'fr_FR', 'yaml'),
Expand Down
22 changes: 20 additions & 2 deletions ja/core-libraries/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ CakePHP のバリデーションは、任意の配列データに対するバリ

$validator = new Validator();

// オブジェクトインスタンスを用いる
// オブジェクトインスタンスを使います
$validator->setProvider('custom', $myObject);

// クラス名を用いる。メソッドは静的なものでなければならない
// クラス名を使います。メソッドは静的なものでなければなりません
$validator->setProvider('custom', 'App\Model\Validation');

バリデーションプロバイダーは、オブジェクトか、あるいはクラス名で設定されます。
Expand All @@ -186,6 +186,24 @@ CakePHP のバリデーションは、任意の配列データに対するバリ
'provider' => 'table'
]);

今後作成される全ての ``Validator`` オブジェクトに ``provider`` を追加したい場合、
以下のように ``addDefaultProvider()`` メソッドを使用できます。 ::

use Cake\Validation\Validator;

// オブジェクトインスタンスを使います。
Validator::addDefaultProvider('custom', $myObject);

// クラス名を使います。メソッドは静的なものでなければなりません。
Validator::addDefaultProvider('custom', 'App\Model\Validation');

.. note::

デフォルトプロバイダーは、 ``Validator`` オブジェクトが作成される前に追加されなければなりません。
そのため **config/bootstrap.php** がデフォルトプロバイダーの設定に最適な場所です。

.. versionadded:: 3.5.0

国に基いて提供するための `Localized プラグイン <https://github.com/cakephp/localized>`_
が利用できます。このプラグインで、国に依存するモデルのフィールドをバリデートできます。
例::
Expand Down
8 changes: 7 additions & 1 deletion ja/orm/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ CakePHP の ORM を使うためにエンティティークラスを生成する
$user->title = 'foo'; // 同時に slug が設定されます。
$user->set('title', 'foo'); // 同時に slug が設定されます。

.. warning::

アクセサーは、エンティティーがデータベースに永続化される前にも実行されます。
フィールドを変換したいけれど、変換したものを永続化したくない場合、
永続化されない仮想プロパティーの使用をお勧めします。

.. _entities-virtual-properties:

仮想プロパティーの生成
Expand Down Expand Up @@ -204,7 +210,7 @@ CakePHP の ORM を使うためにエンティティークラスを生成する

エンティティーのプロパティーが変更されたかどうかに応じるコードを
作りたいと思うことがあるかもしれません。例えば、フィールドが変更された時にだけ
バリデートしたい場合です。::
バリデートしたい場合です。 ::

// タイトルが変更された時に、.
$article->dirty('title');
Expand Down
2 changes: 1 addition & 1 deletion ja/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ CakePHP の既定のレイアウトは **src/Template/Layout/default.ctp** に
コントローラーのアクションの中か、ビューの ``$layout`` プロパティーで切り替えるだけです。 ::

// コントローラーから
public function admin_view()
public function view()
{
// レイアウトの設定
$this->viewBuilder()->setLayout('admin');
Expand Down