Hi jcsiegr...,
Thank's for your quick reply.
Do I understand it right that the table i18n & i18n_content stores
translations for each table that uses it? So a news table and a pages
table store their translations in the same i18n combo?
If that's right the structure for news would be:
Table: news
id: int(8)
title: varchar(255)
content: text
...other fields
Example record for news
id = 5
title = title for this article
content = some content...
Example record 1 in i18n:
id= autoincr. value...
locale= en_US
i18n_content_id= 10 (---> id from i18n_content record)
model= News
row_id= 5 (---> id from news table)
field= title
Example record 2 in i18n:
id= autoincr. value...
locale= fr_FR
i18n_content_id= 11 (---> id from i18n_content record)
model= News
row_id= 5 (---> id from news table)
field= title
Example record 1 (en_US) in i18n_content
id = 10 (---> as used in i18n example record 1 / i18n_content_id)
content = Title in english
Example record 2 (fr_FR) in i18n_content
id = 11 (---> as used in i18n example record 2 / i18n_content_id)
content = Titre en français
An so on... for the content field in news there would be 2 records in
i18n and 2 records in i18n_content?
Ok, if I am right in the above example how should I adjust your code
example in the model for news, and would that be all ?
var $actsAs = array('Translate' => array(
'title' => 'Translations',
'abstract' => 'TranslationsAbstract',
'text' => 'TranslationsText',
);
Thanks,
On Jun 1, 7:27 am, jcsiegrist <[EMAIL PROTECTED]> wrote:
> The new translation behavior of cake 1.2 will handle the translation
> in the db.
>
> To use init the I18n db tables from the sql at /app/config/sql/
> i18n.sql (should be there in a freshly baked 1.2 app).
>
> In your model do something like:
> var $actsAs = array('Translate' => array(
> 'title' => 'Translations',
> 'abstract' => 'TranslationsAbstract',
> 'text' => 'TranslationsText',
> );
>
> for each of your translateable fields add a key to the array. by using
> 'field'=>'relationname' you create a hasMany relation for that field
> that can be accessed in the data like any other hasMany relation, but
> you can also just set the Fields like array('title' ,'abstract',
> 'text'). The field values will then just be set without extra
> relations. Well even with the relations the translated value will just
> get set, but the hasMany relation is useful for getting all
> translations if you need it.
>
> :jcs
>
> On 1 Jun., 01:23, oleonav <[EMAIL PROTECTED]> wrote:
>
> > What I mean is for example a database with news articles. For every
> > article there is a version in each language supported by the website.
> > Based on the language settings made by the user a localised copy of
> > the article is shown. If a localised version of the article is not
> > available than the version in the default site language is shown, for
> > example English.
>
> >Symfonyuses a table structure like this:
>
> > Table: news
> > Fields: id, ...
>
> > Table news_i18n
> > Fields: id, news_id, language, title, content, ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---