• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Languages - different urls?

#1
[eluser]Kriesi[/eluser]
Hello everyone, I got a question concerning multi language sites and was not able to find the answer in existing threads.

My problem: I am creating a site that will be released with multiple languages. The customer wants to have the URLs search engine optimized which means I cannot simply append the language code in a segment, i need a completely different URL but i want the sites to be created by the same controllers.

for example I got an English page with URL:

http://www.mydomain.com/about_us/contact/

the German version should look like this:

http://www.mydomain.com/ueber_uns/kontakt/

is there a way that one controller can create those 2 URLs? Since the site will eventually be released with 5-7 languages and about 30-40 pages I would like to circumvent heavy rewrite rules in the htaccess file :/

Best regards
Christian

#2
[eluser]tomcode[/eluser]
You can work with _remap() in the Controller, see the User Guide, Remapping Function Calls.

In the remap() method You catch Your URI segments and search the database.

P.S.:
Quote:... which means I cannot simply append the language code in a segment, i need a completely different URL ...
Why shouldn't work a language specific segment ?

#3
[eluser]Kriesi[/eluser]
Thanks, already stumbled upon the route variable, this function might be even better suited to my need.

And of course it would work (and would be easier) to simply append the segment with the language code but someone from germany should get a german url for better understanding whats going on on the site just by taking a glimspe at the url. this might not be the case if each url shows english words with just a language code at the end.

#4
[eluser]Kriesi[/eluser]
Ok that solved most problems for me, thanks a lot. however when I use the _remap function the only parameter that is passed is the first segment of my url. How do I get the other ones?

for example my site is:

http://www.mysite.com/registration/step1

Code:
_remap($method)
{
    echo $method;
}

always echos "registration" but I also need to know which step of the registration the user is requesting ...

the only way of retrieving this data i found is to use the $this->uri->segment(3, 0); method. Is there another way as well?

Best reagards and thanks in advance =)
Kriesi


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.