This is a very common function name in
multiple languages and frameworks for translation as it is a very frequently used function and it is less
distracting in the source code if it is short. As you can see in (2)m the _() function also supports the use of
printf() placeholders so that you can embed some dynamic text in the correct place. The current date is a good
example as in English we say ???Today??™s date is {date}??? whereas in another language, the idiom may be ???{date}
is today??™s date???. By using printf() placeholders, we are able to move the dynamic data to the correct place for
the language construct used.
The array adapter is mainly useful for very small projects. For a large project, the gettext() format or csv
format is much more useful. For gettext(), the translation text is stored in .po files which are best managed
using a specialized editor, such as the open source poEdit application.. These applications provide a list of the
source language strings and next to each one, the translator can type the target language equivalent string. This
makes creating translation files relatively easy and completely independent of the website source code.
The process of using gettext() source files with Zend_Translate is as simple as picking a different adapter
as shown in listing 14.
Pages:
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350