Welcome to the Cookbook

loading...

6.3.2 Attaching the Translate Behavior to your Models

There is no translation yet for this section. Please help out and translate this.. More information about translations

Add it to your model by using the $actsAs property like in the following example.

<?php
class Post extends AppModel {
	var $name = 'Post';
	var $actsAs = array(
		'Translate'
	);
}
?>
  1. <?php
  2. class Post extends AppModel {
  3. var $name = 'Post';
  4. var $actsAs = array(
  5. 'Translate'
  6. );
  7. }
  8. ?>

This will do nothing yet, because it expects a couple of options before it begins to work. You need to define which fields of the current model should be tracked in the translation table we've created in the first step.