![]() |
language go about question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: language go about question (/showthread.php?tid=2645) |
language go about question - El Forum - 08-16-2007 [eluser]Marc Arbour[/eluser] Hi to all the community. I am developping a website with proper language files like the way it should be. I can change my default language value in the config.php file and everything works fine. This website can be accessed at CiĀ³.ca. I saw on my other website (working the exact same way with the exception of a language selector) that google doesn't index the french side. Is there any way to transform this: http://www.ci3.ca/index.php/example.html into this: http://www.ci3.ca/index.php/french/example.html and this: http://www.ci3.ca/index.php/english/example.html so that the proper language file is taken automatically without changing the config.php or installing a language selector? Any help would be appreciated. Thank you in advance. language go about question - El Forum - 08-16-2007 [eluser]Michael Wales[/eluser] You could use URI routing to direct the /language/controller/method requests to your currently configured controllers. Within the controller - use $this->uri->segment(1) with your language loading methods to load the appropriate language. You'll probably have to do some work on the URI class as well - if using the anchor() method - to ensure the language is carried over between links. From an SEO standpoint - I would not move the english translation over to the /language/controller/method URL scheme - as Google has already started indexing your site using these URLs. I would leave english as the default (if not language has been selected) and then use your new scheme for any language other than english. language go about question - El Forum - 08-16-2007 [eluser]Marc Arbour[/eluser] Thank you for that. If I understand correctly (being an old type php coder and VERY new to the MCV scheme), I need to take possession of the first URI segment and tell the URI class that? Usually, of what I understand, the 1st uri segment is a function to be called. I did try a couple of things already, but aside 404 and blank pages, I acheived nothing. I made a full text search for segment(1) and found it hardcoded into the scafolding and databases files. So since it's hardcoded... I guess I should try using the 1 "always" available parameter which is URI segment 2. would that be better? my last idea would be to create 2 dirs at my httpdocs root, french and english... creating simlinks for all the files but for the config. Then I would have ci3.ca/french/index.php and ci3.ca/english/index.php That way, I don't have to hack the core or anything. language go about question - El Forum - 08-16-2007 [eluser]Marc Arbour[/eluser] Ok, I got it. simply created index_french and index_english in the httpdocs and changed values for $application_folder It did the trick. It's not as elegant as I'd hoped, but it works. I just need to cron a job to sync my "copied" $application_folder every now and then in case I change something on the site. Thanks language go about question - El Forum - 08-17-2007 [eluser]trailer123[/eluser] All the best Mac. Keep up the good work. ![]() language go about question - El Forum - 08-17-2007 [eluser]Marc Arbour[/eluser] Ok. I polished my solution again. It doesn't involve the creation of a second subdir. I copied-pasted the index as said I added Code: $language_index = "english"; //allowed values are those for which you have language files properly installed in CI Then, I added Code: define('APP_LANGUAGE', $language_index); And last, I changed, respectively, lines 26 and 40 for Code: $config['language'] = APP_LANGUAGE; It works a charm. Could anyone tell me if they foresee any problem with this solution and is it worth making a wiki with this. Best regards. language go about question - El Forum - 08-17-2007 [eluser]Marc Arbour[/eluser] This is "wiki'ed" here: http://codeigniter.com/wiki/allowing_search_engines_to_spider_all_your_langages/ for future references. |