Zend_Translate can handle different adapters for translation. Each adapter has its own advantages and disadvantages. Below is a comprehensive list of all supported adapters for translation source files.
Таблица 31.1. Adapters for Zend_Translate
Adapter | Description | Usage |
---|---|---|
Array | Use php arrays | Small pages; simplest usage; 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; thread-safe; needs tools for translation |
TMX | Use tmx (*.tmx/*.xml) files | Industry standard for inter application translation; XML format; human readable |
XLIFF | Use xliff (*.xliff/*.xml) files | A simpler format as TMX but related to it; XML format; human readable |
Others | *.sql, *.tbx, *.qt | Different other adapters may be implemented in the future |
You should decide which Adapter you want to use for Zend_Translate. Frequently, external criteria such as a project requirement or a customer requirement determines this for you, but if you are in the position to do this yourself, the following hints may simplify your decision.
The Array Adapter is the Adapter which is simplest to use for programmers. But when you have numerous translation strings or many languages you should think about another Adapter. For example, if you have 5000 translation strings, the Array Adapter is possibly not the best choice for you.
You should only use this Adapter for small sites with a handful of languages, and if you or your programmer team creates the translations yourselves.
The Csv Adapter is the Adapter which is simplest to use for customers. CSV files are readable by standard text editors, but text editors often do not support utf8 character sets.
You should only use this Adapter if your customer wants to do translations himself.
The Gettext Adapter is the Adapter which is used most frequently. Gettext is a translation source format which was introduced by GNU, and is now used worldwide. It is not human readable, but there are several freeware tools (for instance, POEdit), which are very helpful. The Zend_Translate Gettext Adapter is not implemented using PHP's gettext extension. You can use the Gettext Adapter even if you do not have the PHP gettext extension installed. Also the Adapter is thread-safe and the PHP gettext extension is currently not thread-safe.
Most people will use this adapter. With the available tools, professional translation is very simple. But gettext data are is stored in a machine-readable format, which is not readable without tools.
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 must 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 as fast as with gettext files.
Most medium to large companies use this adapter. The files are human readable and system-independent.
The Xliff Adapter is the Adapter which will be used by most customers which want to have XML files but do not have tools for TMX. XLIFF is a XML file based format, which is related to TMX but simpler as it does not support all possibilities of it. XML files are human-readable, but the parsing is not as fast as with gettext files.
Most medium companies use this adapter. The files are human readable and system-independent.