unnati
unnati

Reputation: 65

how to integrate multiple language in zend framework

i want to integrate multiple language in zend project.for that i have studied http://framework.zend.com/manual/1.0/en/zend.translate.using.html but..from that i didn't get idea of how it can be done..even it doesn't show on which page i have write code.in which page what code should..i am so,confuse..can anyone give me idea how i can integrate language with zend so my site can be translated in any language

Upvotes: 0

Views: 204

Answers (1)

Ravi Kant Mishra
Ravi Kant Mishra

Reputation: 768

This may not be the best solution but it may be useful for you.

Multiple adapters are available in ZF you can choose anyone Zend_Transalate adapters Array, Csv, Gettext, Ini, Tbx, Tmx, Qt, Xliff.

for CSV

1) Create a different CSV files for each languages that you are going to use. eg : en.csv hn.csv

2) Create constants for each word/sentence that you are going to use in your application. Save all the constants and their values into their respective CSV. eg : constant value

3) Load the language file

$translate = new Zend_Translate('csv', "/pathtofile/$lngfile.csv", 'en');
Zend_Registry::set('Zend_Translate', $translate);

You can carry $lngfile variable in the URL eg: /en/controller/action/

4) For showing translated values in phtml $this->translate('constant_name');

Upvotes: 1

Related Questions