This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

language wise routing file

Notes and reports about symfony 1.0.x stable

language wise routing file

by gaurangrajvir » Tue May 10, 2011 2:09 pm

Hi,
i have developed site which has two language
english and spanish

now my routing rule something like below

news:
url: /news
param: {module: news, action: list}


I want to do something like below.

now when url explore site in english that time in url => http://localhost/project/news

and when url explore for site in spaining that time in url => http://localhost/project/noticias

So how can i do this ?

Thanks in advance
User avatar
gaurangrajvir
Senior Member
 
Posts: 192
Joined: Wed May 16, 2007 7:51 am
Location: RAJKOT

Re: language wise routing file

by gaurangrajvir » Wed May 11, 2011 12:26 pm

anyone ???
User avatar
gaurangrajvir
Senior Member
 
Posts: 192
Joined: Wed May 16, 2007 7:51 am
Location: RAJKOT

Re: language wise routing file

by gaurangrajvir » Sat May 21, 2011 7:11 am

Please Suggest if have anything about this.

Thanks
User avatar
gaurangrajvir
Senior Member
 
Posts: 192
Joined: Wed May 16, 2007 7:51 am
Location: RAJKOT

Re: language wise routing file

by Tirthesh » Mon Aug 01, 2011 3:58 pm

Hi,

Is it solved ?
Tirthesh
Symfony 1.4.8 + Propel 1.4.2
Tirthesh
Member
 
Posts: 78
Joined: Fri Nov 26, 2010 8:27 am

Re: language wise routing file

by bksunday » Mon Mar 12, 2012 6:52 pm

I was looking for something like that too and there still isn't any answer here that I would like to see, so here is what I do for now:

do what the books says for /:sf_culture in the url

then define 2 routes:
Code: Select all
news_en:
  url: /:sf_culture/news
  param: {module: news, action: list}
  sf_culture: en

news_es:
  url: /:sf_culture/noticias
  param: {module: news, action: list}
  sf_culture: es

now when you call your routes, you can use:
Code: Select all
url_for('@news_'.$sf_user->getCulture());


* you might have to name your routes with the country language too like en_US depending on how you define it
Bk.
bksunday
Junior Member
 
Posts: 7
Joined: Thu Jul 02, 2009 1:38 am
Location: Montreal

Re: language wise routing file

by Tirthesh » Wed Jul 11, 2012 10:01 am

ok,

I was thinking, if we can use session vars & i18n inside a yml file - that way it would be easier.

Fine.
Tirthesh
Symfony 1.4.8 + Propel 1.4.2
Tirthesh
Member
 
Posts: 78
Joined: Fri Nov 26, 2010 8:27 am

Re: language wise routing file

by gaurangrajvir » Wed Jul 11, 2012 10:36 am

Okay thank for your view.
User avatar
gaurangrajvir
Senior Member
 
Posts: 192
Joined: Wed May 16, 2007 7:51 am
Location: RAJKOT