4.2. Adapters for Zend_Translate

Zend_Translate can handle different adapters for translation. Each adapter has it's own pros and cons. Here you can find a comprehensive list of all supported adapters for translation source files.

Table 4.1. Adapters for Zend_Translate

Adapter Description Useage
Array Use php arrays Small pages, simplest useage, only for programmers
Csv Use comma seperated (*.csv/*.txt) files Simple text file format, very fast, possible problems with unicode characters
Gettext Use binary gettext (*.mo) files Gnu standard for linux, very fast, threadsave, needs tools for translation
Tmx Use tmx (*.tmx) files Industry standard for inter application translation, xml format, human readable
Others *.xliff, *.sql, *.tbx, *.qt Different other adapters are supposed to be implemented in the future but not ready for now

4.2.1. How to decide which translation adapter to use

First of all you should decide which Adapter you want to use for Zend_Translate. Most times your Customer will decide for you but if you are in the Position to to this yourself, we give you some hints to simplify you your decision.

4.2.1.1. Zend_Translate_Adapter_Array

The Array Adapter is the Adapter which is simplest to use for Programmers. But when you have much translation strings or much languages you should think about another Adapter. If you have for example 5000 translation strings the Array Adapter is posibly not the best choice for you.

You should only use this Adapter for small sites with only a handfull languages and if you or your programmer team does translations your own.

4.2.1.2. Zend_Translate_Adapter_Csv

The Csv Adapter is the Adapter which is simplest to use for Customers. Csv files are readable by standard text editors but you will have problems when you want to use it with utf8 charactersets.

You should only use this Adapter if your customer want to do translations himself.

4.2.1.3. Zend_Translate_Adapter_Gettext

The Gettext Adapter is the Adapter which is used most of times. Gettext is a translation source format which was introduced by Gnu and nowadays used worldwide. It is not human readable but there are several freeware tools (f.e. POEdit) out there which are very helpfull. The Zend Framework is not related to PHP's gettext extension. You can use the gettext adapter even if you do not have the extension installed. Also the Adapter is threadsave and the extension is not for now.

Most people will use this adapter. With the avaiable tools also professional translation is very simple. But this format is not readable without tools.

4.2.1.4. Zend_Translate_Adapter_Tmx

The Tmx Adapter is the Adapter which will be used by most customers which have multiple systems which use the same translation source or when the translation source have to be system independent. Tmx is a XML file based format, which is announced to be the next industry standard. Xml files are human readable but the parsing is not that fast as with gettext files.

Most medium to big sized companys will use this adapter. The files are human readable and system independent.