Hello,

I have multiple languages on my site (right now just English and
French). English is the default layouts and views. French is a theme
called 'french'. Sometimes I apply other themes for clients, so I
create themes and just override the views I want. The problem is, for
a french language site, if a themed view file doesn't exist it
defaults back to English. I want the French sites (identified by a
language_id field in the database) to default to the 'french' theme if
the theme file isn't found.

I've considered a couple of ways to do this:

1.

Put in my app_controller - where themes are applied:

if (file_exists('/views/themed/theme_name/'.$this-
>params['action'].'.ctp') {
        $this->theme = 'theme_name';
} else {
       if ($language_id==2) {
                 $this->theme = 'french'
       }
}

This solution is ok, but I'm not crazy about it as I'm probably
duplicating functionality from cakes core classes.

2.

Ditch themes for languages and create multi-language view files
(English and French are identical except for text being translated -
same stylesheets). Also not crazy about this, I like my clean view
files with very little PHP in them.

Does the community have any better suggestions to handle Language
switching?

Thanks in advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to