テーブルからすべての行を照会し、すべての言語ですべての行を取得します...
例: GalleryCategoriesController.php
<?php
class GalleryCategoriesController extends AppController
{
function index()
{
$galleryCategories = $this->GalleryCategory->find('all');
print_r($galleryCategories);
$this->set('galleryCategories', $galleryCategories);
}
}
?>
GalleryCategory.php (モデル)
<?php
class GalleryCategory extends AppModel
{
public $tablePrefix = 'ef_';
var $name = 'GalleryCategory';
public $actsAs = array('Translate' => array(
'title' => 'titleTranslation',
'title_sub' => 'titleSubTranslation',
'description' => 'descriptionTranslation'
)
);
}
?>
結果:
Array
(
[0] => Array
(
[GalleryCategory] => Array
(
[id] => 1
[gallery_category_id] => 0
[title] => Test title
[title_sub] => Test subtitle
[description] => Test description
[status] => 2
[locale] => hun
)
[titleTranslation] => Array
(
[0] => Array
(
[id] => 65
[locale] => hun
[model] => GalleryCategory
[foreign_key] => 1
[field] => title
[content] => Test title hungarian
)
[1] => Array
(
[id] => 80
[locale] => eng
[model] => GalleryCategory
[foreign_key] => 1
[field] => title
[content] => Test title english
)
)
[titleSubTranslation] => Array
(
[0] => Array
(
[id] => 66
[locale] => hun
[model] => GalleryCategory
[foreign_key] => 1
[field] => title_sub
[content] => Test subtitle hungarian
)
[1] => Array
(
[id] => 81
[locale] => eng
[model] => GalleryCategory
[foreign_key] => 1
[field] => title_sub
[content] => Test subtitle english
)
)
[descriptionTranslation] => Array
(
[0] => Array
(
[id] => 67
[locale] => hun
[model] => GalleryCategory
[foreign_key] => 1
[field] => description
[content] => Test description hungarian
)
[1] => Array
(
[id] => 82
[locale] => eng
[model] => GalleryCategory
[foreign_key] => 1
[field] => description
[content] => Test description english
)
)
)
)
どうすればハンガリー語の翻訳だけを入手できますか? Web サイトに 6 つの言語があり、何かを照会すると、6 つの言語で取得されるため... ひどいです...