multilanguage website |
[eluser]bmwww[/eluser]
hello everybody. I have already developed 5 website with codeigniter and i think it is a very usefull framework. The only thing i have never been able to do is to create a multilanguage website with the language in the url. for example a would like to have an url like this: myDomain.com/IT/myPage.html for the italian language and myDomain.com/EN/myPage.html for the english language. The only way i found out is to create two different controllers: one for IT and one for EN, but this solution was not so simple to manage expecially if there was a lot of code for each file. To make multilanguage working i created a function that sets the current language in one cookie and all work correctly but ther is no IT or EN on the url. Do nobody know how to make a website multilanguage with language wrote on the url ?? thanks, regards
[eluser]cahva[/eluser]
Internationalization (i18n) library for CodeIgniter I used this a couple of times now and it works great and does exactly what you are after.
[eluser]bmwww[/eluser]
thanks for your quick reply. It is just what i was looking for!!! i followed the link's example and all works correctly except for the url rewrite. If i remove "index.php" with my .htaccess file it stops working and returns only the english wersion. without url rewrite: http://multilanguage.test.lan/index.php/en/about (ok, returns english lang) http://multilanguage.test.lan/index.php/fr/about (ok, returns french lang) with url rewrite: http://multilanguage.test.lan/en/about (ok, returns english lang) http://multilanguage.test.lan/fr/about (no, returns still english lang) this is my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> thanks
[eluser]cahva[/eluser]
I'm in a hurry now but did you remember to remove the index.php from config.php also? Code: $config['index_page'] = "";
[eluser]Tominator[/eluser]
I am using: http://codeigniter.com/wiki/URI_Language_Identifier/ It's more simpler for me.
[eluser]Isern Palaus[/eluser]
Hello, You can also check: http://ellislab.com/forums/viewthread/146018/#713596 Will help you if you want your content multilingual in database.
[eluser]bmwww[/eluser]
now it's working fine ... my Apache was not correctly configured :-) thank you very much CAHVA your solution is exactly what i was looking for !! Thanks also to the other but i have followed the first guide and all is perfect! regards
[eluser]bmwww[/eluser]
Hello to all, I’m continuing the development of my website with codeigniter and I encountered a problem with pagination. In the administration section, which does not use internationalization with I18N, everything works correctly. Instead in the frontend which use I18N internazionalization (it for italian language and en for english) I found a strange problem in pagination. When I load the page that contains the paging everything seems to work, infact appear first 4 elements and below appear pagination links. I have a total of 5 elements. The number 1 appears selected, number 2 appears unselected and link to next page appears unselected. when I click on link 2 to go to the second page of the pagination i get the last element and below the pagination. From this moment the pagination doesn’t work anymore. I get always the first page selected on the pagination and clicking on the second nothing change. Can be a problem of url that contains language "it" or "en" ?? this is my code: blog.php -> my controller Code: function index() post_model.php -> my model Code: function post_tutti_paginati_lingua($num, $offset, $lang) blog.php -> my view Code: echo $this->pagination->create_links(); Thanks for help
[eluser]phpserver[/eluser]
There is a better way of handling multiple languages.http://maestric.com/doc/php/codeigniter_i18n
[eluser]bmwww[/eluser]
Hello, I studied the same page to learn about the multilingual with i18n and everything works correctly. The problem is that I can’t operate pagination. |
Welcome Guest, Not a member yet? Register Sign In |