Tuesday, March 23, 2010

Re: Themes and Languages

If all you need is language support and the layout is identical use gettext.
See the following thread
http://groups.google.com/group/cake-php/browse_thread/thread/f8c98544bd6352ee/8e43b549197028ee?hl=en&lnk=gst&q=zaky+po#8e43b549197028ee


On Mon, Mar 22, 2010 at 10:20 PM, Kareem Sabri <kareemsjunk@gmail.com> wrote:
> 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com 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.
>

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com 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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate