Skip to content

Multilingual Behavior

alkemann edited this page Sep 13, 2010 · 1 revision

Instructions on how to use Multilingual behavior

Introduction

CakePHP core comes with a Translation behavior, but that is solution is implemented using an i18n table with the data stored vertically. This behavior works in much the same way as the Revision and Drafted behaviors by employing a shadow table. Another major difference is the concept of a default language. With Multilingual behavior, your model and table acts completely normal whenever you access the default language. The translated data is kept horizontally in the locales table where one row here represent one of the possible translations of the associated row in the main model.

Install instructions

  1. Make sure you have the latest version of Multilingual behavior (/app/models/behavior/multilingual.php)
  2. Add it the model’s actsAs array
  3. Create a `_`locales table

The _locales table should be named the same as the live table with ‘_locales’ added a the end. It should contain these fields :

  • trans_id – int – autoincrement – primarykey
  • locale – varchar
  • plus fields identical to the ones you want translated

Usage examples

comming soon!

Clone this wiki locally