Internationalization and Translation
QQubed offers internationalization support via
QApplication::Translate() (which internally
will use the
QI18n class). Default language and country
settings can be setup in
prepend.inc.php. Out of the box, QCubed 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.)
If at any point, you wish to translate to a different language than the one set by the session,
you can use the
QI18n::Load() function to create a unique I18n object, and call
TranslateToken()
on it.
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
/home4/ugocompa/public_html/arbitrareperu/Arbitrare2018//includes/qcubed/i18n directory. Note that
you can modify the location of the PO files by changing the
__QI18N_PO_PATH__ constant in
your configuration.inc.php file.
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 QCubed 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). QCubed-specific
langauge files are part of QCubed core, and exist in
/home4/ugocompa/public_html/arbitrareperu/Arbitrare2018//includes/qcubed/i18n.
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 QCubed 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
/home4/ugocompa/public_html/arbitrareperu/Arbitrare2018//includes/tmp/cache/i18n.