Reputation:
I need to create a form in cakephp so that I can insert content in multiple language at the same time.
For example, if I want to use eng
and esp
the form will be like:
Insert english title _____________
Insert spanish title _____________
I'm using i18n for the translated fields but the documentation doesn't say much, can anyone give me some advice?
Also, how can I know how many languages I'm using? Do I have to count the directories in app/locale?
Upvotes: 5
Views: 1409
Reputation: 314
I keep an array in bootstrap.php for all the languages the site is supposed to support. As for inserting translations, if you pass something like:
$data = array('ModelName' => array(
'field_name' => array(
'eng' => 'This is my name',
'deu' => 'Das ist mein name'
)
));
it will properly insert those in the i18n table.
Upvotes: 3