Yii Framework Forum: redirecting home page and language - Yii Framework Forum

Jump to content

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

redirecting home page and language Rate Topic: -----

#1 User is offline   Pabs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-March 11

Posted 18 July 2012 - 09:21 PM

hi all

I have a yii application that uses 2 different languages (french and english)

if I use the following URL it works as it should

but if I type

it goes to the main page but does not recognize the language since it's not passed in the URL...
it doesn't even make it to my message file for translation.

how can I set the language by default so that it always has a language defined? or can I just redirect from my index page to a URL including the lang=en or lang=fr?



#2 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 419
  • Joined: 23-July 09

Posted 19 July 2012 - 03:16 AM

I do it something like this:

	if(isset($_GET['lang'])) {

You must remember that Yii already has language functionality, so make sure your own does not conflict with it, eg. I use en_us, pt_br, it ..... I'm sure its all documented :-)
We were all once expert at....... nothing.


My Blog

#3 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,180
  • Joined: 05-January 12
  • Location:Morocco

Posted 19 July 2012 - 06:10 AM

See this wiki, it should help you (it's very detailed) or give you at least interesting ideas:

SEO-conform Multilingual URLs + Language Selector Widget (i18n)

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