开发者

how to use i18n for one language cakephp

I need to launch a web app in spa开发者_运维百科nish for the moment and I need to translate the app...

I already modified the default.po and added configure::write('Config.language', 'es') to the core.php...

what now? I don't want to add routing rigth now. Any suggestions?

PD: did everything as it is in the manual and @#$%^&%$@@ I cant get it to work


i18n is a tricky one to get your head around. If you're producing a website that will just be in Spanish, there is no need to use it, but I do use po messages as a matter of course, just in case.

There is a component that will help you a lot: http://bakery.cakephp.org/articles/p0windah/2007/09/12/p28n-the-top-to-bottom-persistent-internationalization-tutorial

There also used to be a script that would allow translation of slugs so that SEO would direct you to the right language. Last time I looked, it had vanished, but I'll try to piece it together for you.

For the moment, this is what I used in router.php

//route to switch locale
Router::connect('/lang/*', array('controller' => 'p28n', 'action' => 'change'));

//forgiving routes that allow users to change the lang of any page
Router::connect('/eng?/*', array(
    'controller' => "p28n",
    'action' => "shuntRequest",
    'lang' => 'en-gb'
));

Router::connect('/ca?/*', array(
    'controller' => "p28n",
    'action' => "shuntRequest",
    'lang' => 'cat'
));

Router::connect('/es?/*', array(
    'controller' => "p28n",
    'action' => "shuntRequest",
    'lang' => 'es_es'
));

I'll dig around for the url translation, but it may take a while....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜