Welcome Guest, Not a member yet? Register   Sign In
Routing for multilingual urls
#2

(09-01-2015, 02:07 AM)Lykos22 Wrote: Hi I'd like some help for setting up my routes properly for multilingual pages.

The url from my pages look like this:

Code:
controller/index
controller/method
controller/method/param1
controller/method/param1/param2 etc etc

What I'd like to do is to prepend on the url the selected language and have the ability to pass many params on my url, using a single route if possible.. So basicaly instead of using many routes, like this:

PHP Code:
$route['eng/(:any)'] = '$1/index/eng'// controller/index/lang
$route['eng/(:any)/(:any)'] = '$1/$2/eng'// controller/function/lang
$route['eng/(:any)/(:any)/(:any)'] = '$1/$2/$3/eng'// controller/function/param/lang
etc etc 
 
which is not very efficient actually, I was wondering whether there's a way to use a single route to do this, something like this:

PHP Code:
$route['eng/(:any)/(:any)/unlimited parameters'] = '$1/$2/unlimited parameters/eng'// which is controller/method/unlimited params/lang 


Hello my friend! How are you?

I'm not sure why you want to such thing like this. When I have to work with multilingual applications I usually use the Language Library. You can set the actual language in a session ou cookie and then use the appropriate language as shown you the Library docs.
That will keep you code and urls clean.

I don't know if that solves your problem, but it's a solution for the multilingual issue.
The web is so cool! That you need to do cool stuff... Wink
Reply


Messages In This Thread
Routing for multilingual urls - by Lykos22 - 09-01-2015, 02:07 AM
RE: Routing for multilingual urls - by JoelPiccoli - 09-01-2015, 04:13 AM
RE: Routing for multilingual urls - by PaulD - 09-01-2015, 04:29 AM
RE: Routing for multilingual urls - by sintakonte - 09-01-2015, 04:58 AM
RE: Routing for multilingual urls - by PaulD - 09-01-2015, 05:56 AM
RE: Routing for multilingual urls - by sintakonte - 09-02-2015, 04:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB