Internationalization and Translation
—
Qcodo offers internationalization support via
QApplication::Translate() (which internally
will use the
QI18n class). Language and country
settings can be setup in
prepend.inc.php. By default, Qcodo will check the session to determine
which language and country is currently being used, but it is really up to the developer to
determine how you want the language and country codes get discovered (e.g., via the URL, via
GET arguments, etc.)
Language files are in the GNU PO format (see
http://www.gnu.org/software/gettext/manual/html_node/gettext_9.html
for more information), and are placed in the
/includes/qcodo/i18n directory.
To translate any piece of text, simply use
QApplication::Translate(xxx). Or as a shortcut,
if you want to do a PHP
print() of any translated text in your template, you can use
the qcodo printing shortcut
_t(xxx) -- this does the equivalent of
print(QApplication::Translate(xxx)).
Note that generated Form Drafts and the QControls are all I18n aware -- they will translate themselves
based on the selected language (as long as the appropriate language file exists). Qcodo-specific
langauge files are part of Qcodo core, and exist in
/includes/qcodo/_core/i18n.
Please Note:
we are desparately in need of more language files. If you are able to contribute, please take
the current en.po file and translate it to any currently unsupported language and feel free to
submit it. Also note that the Spanish translation (es.po) language files (both in the example
and in Qcodo core) need to be corrected.
Finally, due to the heavy processing of PO parsing, the results of the PO parsing are cached
using QCache, and cached files are stored in
/includes/qcodo/cache/i18n.