Yii Framework Forum: Is Yii really multilanguage - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Is Yii really multilanguage Rate Topic: -----

#1 User is offline   TAQTICA 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 13-February 10

Posted 27 February 2010 - 08:12 AM

Hi,
I'm trying to build a multilanguage site. Each user should be able to read the site in its own language. I haven't found the way to do it. It seems that it is not possible to change the application language once the user has been authenticated.
0

#2 User is offline   jayrulez 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 348
  • Joined: 29-July 09

Posted 27 February 2010 - 08:24 AM

View PostTAQTICA, on 27 February 2010 - 08:12 AM, said:

Hi,
I'm trying to build a multilanguage site. Each user should be able to read the site in its own language. I haven't found the way to do it. It seems that it is not possible to change the application language once the user has been authenticated.


give more details. What is the approach you're using.
php:
foreach(array('cat', 'dog', 'cow') as $animal) echo $animal."\n";

python:
[(animal, print(animal)) for animal in ['cat', 'dog', 'cow']]

ruby:
['cat', 'dog', 'cow'].each {|animal| puts animal}


You say Tomato, I say Tomato.
0

#3 User is offline   mbi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 604
  • Joined: 08-May 09

Posted 27 February 2010 - 08:28 AM

switch language everywhere you want
Yii::app()->language = "de";

0

#4 User is offline   TAQTICA 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 13-February 10

Posted 27 February 2010 - 09:44 AM

I found the solution.
Language can be kept session array and you have to override the init() for the base controller of the application in order to set the app->language from session value.
Thanks
0

#5 User is offline   yiimann 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 19-December 09

Posted 27 February 2010 - 03:01 PM

Don't forget indexers like google if you store language in session. Google may store wrong versions or may mix up pages with different languages.
2

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users