开发者

Implement Multiple languages in Zend Framework and how to change them?

Im on a project that requires me to translate the project to both swedish and english for the customers that the company got.

Ive made two ini file in

xproject/application/messages-SV.ini.php  <- Swedish
xproject/application/messages-EN.ini.php  <- English

And in my defines.ini.php file Ive included only the messages-SV.ini.php file with:

required_once('messages-SV.ini.php');
#required_once('messages-EN.ini.php');

Ive already added two buttons in my view for the customer to choose from either swedish thats default or english. But I dont know how to make the button send an action to the defines file and then switch to the english file and read from that instead, should I do it via cookies or should I use something else because there is alot of underpages in the diffrent tree structure so I need the language change to be开发者_JAVA技巧 permanent until the user clicks the other language...


this is a big question... zend framework has standard translate component Zend_Translate, which can work with ini files. then you might need to create a language indicator cookie and an action to change it. check this flag on every page load(predispatch maybe) and pass the corresponding ini file to Zend_Translate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜