What is the best approach for implementing multilanugage site in CakePHP:
1) http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and开发者_JS百科-localization/
2) http://cakedc.com/pierre_martin/2010/08/05/i18n-routes-with-cakephp-1-3 3) Or something else?
Thanks!
3) For a website that i worked on, i was asked to translate the url and the pages but REALLY translate the url, for example the urls should be:
[EN]
www.mysite.com/products
[ES]
es.mysite.com/productos
[FR]
fr.mysite.com/produits
I guess this improves SEO when someone makes a search in a specific language. To achieve this, I stored the language in the session and i my routes were something like:
Router::connect(__('/products',true), array('controller' => 'products', 'action' => 'index'));
(Hmm now that i think about it... i dont even need to store the lang in Session because i know the language to display by reading the subdomain.) And if you want to, you can store a cookie to save the preferred language for the user. To change the language, you only need to redirect the user to the corresponding subdomain. (but it will be tricky,but not impossible, if you want to redirect him to the same page he was in but in a different language)
Seems to me that this was a really simple way to translate urls.
Hope this helps
精彩评论