2010-12-01 72 views
0

我需要在西班牙推出的web應用程序的時刻,我需要翻譯應用程序...如何使用國際化的一種語言的CakePHP

我已經修改了default.po並添加配置::寫('Config.language','es')到core.php ...

什麼現在?我現在不想添加路由選擇。有什麼建議麼?

PD:所做的一切,因爲它是在手動和@#$%^ &%$ @@我不能得到它的工作

+0

路由無​​關直接與i18n做,忽略它。你遇到的問題不在[你的其他問題]中(http://stackoverflow.com/questions/4318204/how-to-use-i18n-for-one-language-cakephp)? – deceze 2010-12-01 04:19:56

回答

0

國際化是一個棘手的周圍讓你的頭。如果您生產的網站只是西班牙文版本,則不需要使用它,但我確實使用po消息,以防

有一個組件,它會幫助你很多:http://bakery.cakephp.org/articles/p0windah/2007/09/12/p28n-the-top-to-bottom-persistent-internationalization-tutorial

這裏也曾經是一個腳本,將允許蛞蝓的翻譯,使SEO會引導您正確的語言。上次我看,它已經消失了,但我會盡力爲你拼湊起來。

就目前而言,這是我在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' 
)); 

用我周圍挖的URL翻譯,但它可能需要一段時間....